Remote_function and :with =>

I need to have this remote_function method return more than a single
value. Right now I have it being called when an input field blurs but I
need it to pass more than the value for that one input field - I need it
to pass three values. Here is what I got:

remote_function( :update => ‘h_phone’, :url => { :action =>
‘set_h_phone’, :id
=> @user.id}, :with => "Form.Element.serialize(‘cc2’) )

For the :with, I have tried several variations such as:
:with => “Form.Element.serialize(‘cc2’),
Form.Element.serialize(‘cc3’)”

But that doesn’t work. Is there a way to do this? Thanks in advance,

-S

On 7 May 2008, at 22:10, Shandy N. wrote:

=> @user.id}, :with => "Form.Element.serialize(‘cc2’) )

For the :with, I have tried several variations such as:
:with => “Form.Element.serialize(‘cc2’),
Form.Element.serialize(‘cc3’)”

What are the values you need to pass (what are cc2, cc3 etc… ?)
More generally what you pass to :with should be a query string, so for
example Object.toQueryString({a: 1, b:2}) should work.
Form.Element.serialize() does do that - it will create name=value
pairs, but you do need to glue them together yourself.

Fred

Frederick C. wrote:

On 7 May 2008, at 22:10, Shandy N. wrote:

=> @user.id}, :with => "Form.Element.serialize(‘cc2’) )

For the :with, I have tried several variations such as:
:with => “Form.Element.serialize(‘cc2’),
Form.Element.serialize(‘cc3’)”

What are the values you need to pass (what are cc2, cc3 etc… ?)
More generally what you pass to :with should be a query string, so for
example Object.toQueryString({a: 1, b:2}) should work.
Form.Element.serialize() does do that - it will create name=value
pairs, but you do need to glue them together yourself.

Fred

I ended up using the :submit option. Those fields were for the three
different parts of a phone field. Thanks for the help,

-S

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs