Is there any way to make an Ajax call (like link_to_remote) and pass in
the value of a field on screen? This seems obvious, but I can’t find
anything…
Thanks,
Marcus
Is there any way to make an Ajax call (like link_to_remote) and pass in
the value of a field on screen? This seems obvious, but I can’t find
anything…
Thanks,
Marcus
Marcus B. wrote:
Is there any way to make an Ajax call (like link_to_remote) and pass in
the value of a field on screen? This seems obvious, but I can’t find
anything…
You could not use the helper and do this:
Where url is the url of your controller/action and pars are the params
you wanna pass.
or write your own helper that does this. Didn’t see a way to do it with
the existing one.
Michael T. wrote:
He’s probably talking about the field value at the time the link is
clicked. This can be done with the :with => parameter. Look into it.
ah… would be nice if the api docs had that as part of link_to_remote
options.
Found it under observe_field
:with
“A JavaScript expression specifying the parameters for the
XMLHttpRequest. This defaults to â??valueâ??, which in the evaluated context
refers to the new field value. If you specify a string without a “=”,
itâ??ll be extended to mean the form key that the value should be assigned
to. So :with => “term” gives “â??termâ??=value”. If a “=” is present, no
extension will happen.”
Thanks! will try that.
He’s probably talking about the field value at the time the link is
clicked. This can be done with the :with => parameter. Look into it.
If you need more help let me know.
Michael
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs