I need to call a remote function passing data from the current page
which a user has enterred.
Trying to do things the rails way the closest I could get was this…
<%= link_to_remote ‘Remote Call’, :url => {:action =>
‘add_device’,:serial=>"$(‘serial’).value"} %>
It doesn’t work though because it makes the “$(‘serial’).value” url
safe and passes this string instead of the field value. Note: I
tried :escape => false but that didn’t help.
I need to call a remote function passing data from
the current page which a user has enterred.
Trying to do things the rails way the closest I could get was this…
<%= link_to_remote ‘Remote Call’, :url => {:action =>
‘add_device’,:serial=>"$(‘serial’).value"} %>
I need to call a remote function passing data from
the current page which a user has enterred.
Trying to do things the rails way the closest I could get was this…
<%= link_to_remote ‘Remote Call’, :url => {:action =>
‘add_device’,:serial=>"$(‘serial’).value"} %>
Thanks for that I’m certainly closer to figuring this
out than I was, but I’m still having problems…
Actually, as I re-read your earlier posting, I see I really didn’t help
much
WRT passing back an input value using a link. With a link, you’d
definitely
need to include the value and I didn’t give you that. My bad. I
apologize
for not reading your post more carefully. Jeff showed you how to pass
back
all the form’s values. Using that approach, you could then pull the
param
value you wanted out of the hash. AFAIK, it’s a safe way to
‘pre-submit’
form values. Using submit_to_remote basically does the same thing, but
I
would bet it’s going to give you problems inasmuch as you’ll have more
than
one submit button within your form.
So let me ask… what exactly are you trying to accomplish? Is it just
one
user-entered value that you want to pass back? Is it important that the
visitor explicitly click a link or button to do that? If not,
observe_field
will let you pass a user_entered value quite easily. If it is more than
one
field you need to pass, or if you want the visitor to have to explicitly
submit the value, then it’ll take more. Let us know, before I start
guessing and giving you more bad advice ;-p
Best regards,
Bill
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.