AJAX/RJS Same as mailing address type function

Hello everyone! How are you doing? I am creating a rails app that
handles customer records, etc. But, I am having trouble with some
javascript/ajax stuff.

When creating a customer, the employee will enter in the mailing address
of the new client. After entering the mailing address it is time to
enter the billing address. If the billing address is the same, I have
created a link to simply populate the billing address fields with the
mailing address fields. This is how I am doing it:

<%= link_to_remote "Same as mailing.", :url => { :action => 'set_billing_address' } %>

Here is my set_billing_address.rjs:

page[:billing_address].value = page[:address].value
page[:billing_address2].value = page[:address2].value
... and so on

Well, the billing_address fields are not being populated. I do have all
the id’s set etc. Just to make sure, I did a:

page[:billing_address].value = 'test'
page[:billing_address2].value = 'test'
... and so on

That works just fine.

Are the values of the fields not passed into the javascript when doing a
link_to_remote, is that why it is not working?

I have been searching Google, but no luck. I would appreciate any help!

Thanks,

matt

Matt Do wrote:

Hello everyone! How are you doing? I am creating a rails app that
handles customer records, etc. But, I am having trouble with some
javascript/ajax stuff.

When creating a customer, the employee will enter in the mailing address

Okay, I figured it out. I have to pass link_to_remote with ‘with.’ I
found the solution here (if anyone is also looking for it):

http://www.ruby-forum.com/topic/180603