Forum: Ruby on Rails RJS replace adding multiple inputs

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ed Howland (Guest)
on 2006-05-24 00:17
(Received via mailing list)

I have a classic problem. I want to replace a hidden field inside a
form with a hidden field with some value when a link_to_remote is
pressed. In the link's action rjs, I'm doing the following:

Assume my form has the following field already

<%= hidden_field('client', 'company_id') $>

So I have a bunch of companies in a list with link_to_remote tags to
action select_company.rjs inside which I want:

page.replace "client_company_id", hidden_field("client", "company_id", :
     value =>

But when I do this, it works but it adds an additional blank <input>

<input id="client_company_id", name="client[company_id]" value="4"

Anyone know why?

This topic is locked and can not be replied to.