I am creating a form for users to add part information. I want to include 5 text fields to gather part numbers. The user then submits the forms. Question: Is there a ruby way to loop through the form fields info and extract it on each loop? Thank you for your time in advance. Mitch -- 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 -~----------~----~----~----~------~----~------~--~---
Mitchell Gould wrote:> I am creating a form for users to add part information. > I want to include 5 text fields to gather part numbers. > > The user then submits the forms. > > Question: Is there a ruby way to loop through the form fields info and > extract it on each loop? > > > Thank you for your time in advance. > > MitchTo Clarify, The 5 text fields are for part numbers. The user can enter up to 5 part numbers. Then click submit. -- 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Jul-11 21:46 UTC
Re: How to Loop through mulitple field data no model
On 11 Jul 2008, at 21:38, Mitchell Gould wrote:> > Mitchell Gould wrote: >> I am creating a form for users to add part information. >> I want to include 5 text fields to gather part numbers. >> >> The user then submits the forms. >> >> Question: Is there a ruby way to loop through the form fields info >> and >> extract it on each loop? >>If the inputs are all names parts[] then params[:parts] will be an array containing the 5 entries. Fred>> >> Thank you for your time in advance. >> >> Mitch > > To Clarify, > > The 5 text fields are for part numbers. The user can enter up to 5 > part > numbers. Then click submit. > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 11 Jul 2008, at 21:38, Mitchell Gould wrote: > >>> > If the inputs are all names parts[] then params[:parts] will be an > array containing the 5 entries. > > FredThat makes sense. I will give it a try. Thanks Fred -- 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 -~----------~----~----~----~------~----~------~--~---
Mitchell Gould wrote:> Frederick Cheung wrote: >> On 11 Jul 2008, at 21:38, Mitchell Gould wrote: >> >>>> >> If the inputs are all names parts[] then params[:parts] will be an >> array containing the 5 entries. >> >> Fred > > That makes sense. I will give it a try. > > Thanks FredI tried to user the following for the inputs <%=text_field_tag item[] %> But I get teh following error undefined local variable or method `item'' for #<#<Class:0x35167bc>:0x3516780> -- 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Jul-14 17:58 UTC
Re: How to Loop through mulitple field data no model
On Jul 14, 6:44 pm, Mitchell Gould <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Mitchell Gould wrote: > > Frederick Cheung wrote: > >> On 11 Jul 2008, at 21:38, Mitchell Gould wrote: > > >> If the inputs are all names parts[] then params[:parts] will be an > >> array containing the 5 entries. > > >> Fred > > > That makes sense. I will give it a try. > > > Thanks Fred > > I tried to user the following for the inputs > <%=text_field_tag item[] %> > > But I get teh following error >well yes, there is no local variable called item. You need to pass text_field_tag the name you want ie ''item[]'' Fred> undefined local variable or method `item'' for > #<#<Class:0x35167bc>:0x3516780> > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On Jul 14, 6:44�pm, Mitchell Gould <rails-mailing-l...@andreas-s.net> > wrote: >> >> > Thanks Fred >> >> I tried to user the following for the inputs >> � � � � � �<%=text_field_tag �item[] %> >> >> But I get teh following error >> > well yes, there is no local variable called item. You need to pass > text_field_tag the name you want ie ''item[]'' > > FredThanks Fred, sorry about the dumb question. I have that working now. Thanks again, Mitch -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---