javascript - Rails Show value from a select box on change method -
i'm trying show value model, when select box value changes. code it's this.
<%= f.label :nit , "client nit:" %> <%= f.collection_select(:nit, client.all, :nit, :nit, :prompt => "select nit")%>
my client model has name , nit, need display value according nit selection example:
i have in table:
nit=>name 12345678=>john doe 987654321=>bruce wayne 327654=>clark kent
if choose first 1 in select box, need display "john doe".
i'm trying nothing works me.
try this
<%= f.collection_select(:nit, client.all,:nit,:name,:prompt => "select nit")%>
Comments
Post a Comment