Update multiple fields with onclick

We’ve all seen the checkout forms with Bill To: and Ship To: I’d like
to have a button that says “Ship to Bill To:” and if we click it, it
copies all the Ship To: fields across such as phone, email, etc.
I’ve been looking at link_to_function, is that the right path?
I’ve done observe_fields before but that went to a controller action
whereas here we could get by just copying params[field_values].
Thanks,
David

InventoryTrackers wrote:

We’ve all seen the checkout forms with Bill To: and Ship To: I’d like
to have a button that says “Ship to Bill To:” and if we click it, it
copies all the Ship To: fields across such as phone, email, etc.
I’ve been looking at link_to_function, is that the right path?

Probably. The JavaScript for this should be very simple to write. If I
were you, though, I wouldn’t use link_to_function unless you’re already
on Rails 3: Rails 2’s JS helpers mix JS into your HTML, where it really
doesn’t belong.

I’ve done observe_fields before but that went to a controller action
whereas here we could get by just copying params[field_values].
Thanks,
David

Probably a whole lot easier if you just have a checkbox indicating if
the ship is the same as the bill_to. Pretty common to do that less
hassle.