I am trying to pass the result from a javascript function along with
the result from a text_field with form_remote_tag. This is what I
have so far, but no go:
where test() is the javascript function. This allows me to access the
result of the test function in params[:data]. It seems that I should
be able to do the same with form_remote_tag, but I have been
unsuccessful. Maybe a syntax mistake? Maybe not possible?
I am trying to pass the result from a javascript function along with
the result from a text_field with form_remote_tag. This is what I
have so far, but no go:
Short answer: learn more javascript
Long Answer: The behaviour of with is basically identical for
link_to_remote and form_remote_tag. There is no function called
request, so this can't work as is. Functions are not automatically
added for input element. $F('foo') returns the value of the element
with id foo and should do the trick (just check in the generated html
what the id of the text field is). I also wrote some stuff about :with
at :with or :without you: link_to_remote's mysterious parameter - Space Vatican
Having said all that you don't need any of that here - the form will
submit the value of the text field anyway, no :with needed.
result() is the name of a javascript function that I have defined
within a script in the head element. calling it in :with sets this
result to data, which can then be accessed with params[:data] in the
action create.
result() is the name of a javascript function that I have defined
within a script in the head element. calling it in :with sets this
result to data, which can then be accessed with params[:data] in the
action create.
Well your initial post is using a function called request
Make sure your function returns appropriately format data, other than
that you're going to have to be more explicit about how it doesn't
work.
can anyone help with this syntax? I figure anything that works for
link_to_remote has got to work for form_remote_tag. Does anyone know
if its possible to use the :with to pass parameters using
form_remote_tag? This is what I have so far, but the params[:time]
passed in :with is still nil and it works with link_to_remote.