Hi, I would like to know how to populate data in another text fields on selection from a drop down For Ex 1) The form contains 4 fields out of which 3 are text fields and the 4th one is drop down list. 1) i would like to know how to populate the 3 text fields with data simultaneously on selection from the drop down list. Please Help. -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Koli Koli wrote:> Hi, > I would like to know how to populate data in another text fields on > selection from a drop down > > For Ex > > 1) The form contains 4 fields out of which 3 are text fields and the 4th > one is > drop down list. > 1) i would like to know how to populate the 3 text fields with data > simultaneously > on selection from the drop down list. > > Please Help.Try using observe_field! -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ratnavel Sundaramurthi
2007-Dec-27 09:02 UTC
Re: populate data in another fields on selection
In yr view file add this In View: <%= observe_field ''field_id'', :url => url_for({:controller=> ''yr_controller_name'',:action=>''some_method_in_controller''}), :method => :post, :with => ''field_id'' %> In Controller def some_method_in_controller #... some code to find the objects to be populated in the text fields. ..# page.replace_html ''div_id1'', text_field_tag(''text_field_id_1'',@object) page.replace_html ''div_id2'', text_field_tag(''text_field_id_2'',@object) page.replace_html ''div_id3'', text_field_tag(''text_field_id_3'',@object) end -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> > def some_method_in_controller > #... > some code to find the objects to be populated in the text fields. > ..# > > page.replace_html ''div_id1'', text_field_tag(''text_field_id_1'',@object) > page.replace_html ''div_id2'', text_field_tag(''text_field_id_2'',@object) > page.replace_html ''div_id3'', text_field_tag(''text_field_id_3'',@object) > > endThis didn''t work though can u be more descriptive?? -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ratnavel Sundaramurthi
2007-Dec-28 05:31 UTC
Re: populate data in another fields on selection
wat does it show in development log..? can u paste the error log... -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ratnavel Sundaramurthi wrote:> wat does it show in development log..? > > can u paste the error log...i have 2 tables entries and problems which is associated with each other. The drop down list is poulated with one of the fields of the problems table: i''m able to that corresponding id into the entries table. i have 3 other text fields which shoould be populated with the information of the id that i have selected from the drop down This is the part that i''m not able to do. MY view: <%= error_messages_for ''entry'' %> <% @cats = Problem.find_all %> <tr><td><p> Nature of the problem<br/></td></tr> <tr><td> <select class="types" name="entry[problem_id]" id="entry_problem_id" > <% @cats.each do |cat| %> <option value=<%=cat.id%> > <%= cat.natureofproblem %> </option> <%end%> </select> <tr><td> <tr><td> TEXT FIELD1 <tr><td>TEXT FIELD2 How to populate these text field with the id info that i have from select dropdown. -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Koli Koli wrote:> Ratnavel Sundaramurthi wrote: >> wat does it show in development log..? >> >> can u paste the error log... > cat| %> > <option value=<%=cat.id%> > <%= > cat.natureofproblem %> </option> > <%end%> > </select> > <tr><td> > <tr><td> TEXT FIELD1 > <tr><td>TEXT FIELD2 > > How to populate these text field with the id info that i have from > select dropdown.where do i do the page.replace_html> can u show me a example>> -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Apparently Analagous Threads
- not able to view the images after the upload
- heroku not working /heroku/commands/pgbackups.rb:9:in `<class:Pgbackups>': uninitialized constant He
- Default value for country_select
- [Bug 59069] New: nouveau E[ DRM] fail ttm_validate
- Warcraft 3 - "no program start menu found"