Ruby on Rails Tuesday, May 24, 2016

my SO Link
http://stackoverflow.com/questions/37416737/change-label-based-on-selected-dropdown-ruby-on-rails-4-2

I have a table called network it has the column type and number.

I use this select_tag to get a list of all my network names:

<%= select_tag('NetworksList',
options_from_collection_for_select(Network.all, :id, :name))%>

I also have 2 label fields that I want to populate with information
dynamically:

<p>Network Type: <%= content_tag('span', "", id: 'NetworkType') %></p>
<p>Network Number: <%= content_tag('span', "", id: 'NetworkNumber')
%></p>

When the user selects a network from the dropdown list of network names,
I want to show the selected item's type and number in the fields named
NetworkType and NetworkNumber. I would like this to render in the view
immediately after the user selects a dropdown. How would I do this?

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b2a78ab5503008ac0d1ab77aaf11f10a%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment