I''m developing some sort of imdb (http://www.imdb.com) application for CDs to practice Ruby on Rails. So a user should be able to upload information of a CD that''s not yet in the database. But I''m wondering what would be the possible ways to send information like tracklists. It seems to me the easiest way is a form with an input box per track, but how let the user easily specify how many boxes he needs?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 With the Prototype javascript library you could do something like the following: <ol id=''tracklist''> </ol> <span id=''track_form'' style=''display:none;''> <li><%= text_field_tag ''tracks[]'' %></li> </span> <%= link_to_function ''Add Another Track'', "new Insertion.Bottom (''tracklist'', $(''track_form'').innerHTML)" %> That would put a link on the under the tracklist that will add another form element each time it was clicked. On Nov 21, 2005, at 10:48 AM, Lieven De Keyzer wrote:> I''m developing some sort of imdb (http://www.imdb.com) application > for CDs to practice Ruby on Rails. > So a user should be able to upload information of a CD that''s not > yet in the database. But I''m wondering what would be the possible > ways to send information like tracklists. It seems to me the > easiest way is a form with an input box per track, but how let the > user easily specify how many boxes he needs? > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Darwin) iD8DBQFDgiOuG9xIoXK+giARAkhkAKDbq9v401QvL1P4OgR/zxf1NPgKWACcDm4i +fuPkSADwsU9m8rijvjO864=9LEk -----END PGP SIGNATURE-----
When I click "Add Another Track" it doesn''t do anything with this code.>From: Jeff Smick <rails_lists-m0qWdWgHGwnKl/7hFL4KYti2O/JbrIOy@public.gmane.org> >Reply-To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >Subject: Re: [Rails] Send list of variable size >Date: Mon, 21 Nov 2005 11:44:43 -0800 > >-----BEGIN PGP SIGNED MESSAGE----- >Hash: SHA1 > >With the Prototype javascript library you could do something like the >following: > ><ol id=''tracklist''> ></ol> > ><span id=''track_form'' style=''display:none;''> > <li><%= text_field_tag ''tracks[]'' %></li> ></span> > ><%= link_to_function ''Add Another Track'', "new Insertion.Bottom >(''tracklist'', $(''track_form'').innerHTML)" %> > >That would put a link on the under the tracklist that will add another >form element each time it was clicked. > >On Nov 21, 2005, at 10:48 AM, Lieven De Keyzer wrote: > >>I''m developing some sort of imdb (http://www.imdb.com) application for >>CDs to practice Ruby on Rails. >>So a user should be able to upload information of a CD that''s not yet in >>the database. But I''m wondering what would be the possible ways to send >>information like tracklists. It seems to me the easiest way is a form >>with an input box per track, but how let the user easily specify how many >>boxes he needs? >> >> >>_______________________________________________ >>Rails mailing list >>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>http://lists.rubyonrails.org/mailman/listinfo/rails > >-----BEGIN PGP SIGNATURE----- >Version: GnuPG v1.4.1 (Darwin) > >iD8DBQFDgiOuG9xIoXK+giARAkhkAKDbq9v401QvL1P4OgR/zxf1NPgKWACcDm4i >+fuPkSADwsU9m8rijvjO864>=9LEk >-----END PGP SIGNATURE----- >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I just tried it copy pasted and it worked fine. Are you sure the prototype library is being included? <%= javascript_include_tag ''prototype'' %> should go in at the top of the page. On Nov 21, 2005, at 2:19 PM, Lieven De Keyzer wrote:> When I click "Add Another Track" it doesn''t do anything with this > code. > >> From: Jeff Smick <rails_lists-m0qWdWgHGwnKl/7hFL4KYti2O/JbrIOy@public.gmane.org> >> Reply-To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> Subject: Re: [Rails] Send list of variable size >> Date: Mon, 21 Nov 2005 11:44:43 -0800 >> >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> With the Prototype javascript library you could do something like >> the following: >> >> <ol id=''tracklist''> >> </ol> >> >> <span id=''track_form'' style=''display:none;''> >> <li><%= text_field_tag ''tracks[]'' %></li> >> </span> >> >> <%= link_to_function ''Add Another Track'', "new Insertion.Bottom >> (''tracklist'', $(''track_form'').innerHTML)" %> >> >> That would put a link on the under the tracklist that will add >> another form element each time it was clicked. >> >> On Nov 21, 2005, at 10:48 AM, Lieven De Keyzer wrote: >> >>> I''m developing some sort of imdb (http://www.imdb.com) >>> application for CDs to practice Ruby on Rails. >>> So a user should be able to upload information of a CD that''s >>> not yet in the database. But I''m wondering what would be the >>> possible ways to send information like tracklists. It seems to >>> me the easiest way is a form with an input box per track, but >>> how let the user easily specify how many boxes he needs? >>> >>> >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1.4.1 (Darwin) >> >> iD8DBQFDgiOuG9xIoXK+giARAkhkAKDbq9v401QvL1P4OgR/zxf1NPgKWACcDm4i >> +fuPkSADwsU9m8rijvjO864>> =9LEk >> -----END PGP SIGNATURE----- >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Darwin) iD8DBQFDgl8OG9xIoXK+giARAmteAJ9TqnRXYAMdEg6nSrmR20tAQ+rJkwCg+TS5 oecxF1+HmBrk1gsJVBRGOXw=J1j1 -----END PGP SIGNATURE-----
That was indeed the problem. Sorry. I should start reading about this library I guess.>From: Jeff Smick <rails_lists-m0qWdWgHGwnKl/7hFL4KYti2O/JbrIOy@public.gmane.org> >Reply-To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >Subject: Re: [Rails] Send list of variable size >Date: Mon, 21 Nov 2005 15:58:06 -0800 > >-----BEGIN PGP SIGNED MESSAGE----- >Hash: SHA1 > >I just tried it copy pasted and it worked fine. >Are you sure the prototype library is being included? > ><%= javascript_include_tag ''prototype'' %> > >should go in at the top of the page. > >On Nov 21, 2005, at 2:19 PM, Lieven De Keyzer wrote: > >>When I click "Add Another Track" it doesn''t do anything with this code. >> >>>From: Jeff Smick <rails_lists-m0qWdWgHGwnKl/7hFL4KYti2O/JbrIOy@public.gmane.org> >>>Reply-To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>Subject: Re: [Rails] Send list of variable size >>>Date: Mon, 21 Nov 2005 11:44:43 -0800 >>> >>>-----BEGIN PGP SIGNED MESSAGE----- >>>Hash: SHA1 >>> >>>With the Prototype javascript library you could do something like the >>>following: >>> >>><ol id=''tracklist''> >>></ol> >>> >>><span id=''track_form'' style=''display:none;''> >>> <li><%= text_field_tag ''tracks[]'' %></li> >>></span> >>> >>><%= link_to_function ''Add Another Track'', "new Insertion.Bottom >>>(''tracklist'', $(''track_form'').innerHTML)" %> >>> >>>That would put a link on the under the tracklist that will add another >>>form element each time it was clicked. >>> >>>On Nov 21, 2005, at 10:48 AM, Lieven De Keyzer wrote: >>> >>>>I''m developing some sort of imdb (http://www.imdb.com) application for >>>>CDs to practice Ruby on Rails. >>>>So a user should be able to upload information of a CD that''s not yet >>>>in the database. But I''m wondering what would be the possible ways to >>>>send information like tracklists. It seems to me the easiest way is a >>>>form with an input box per track, but how let the user easily specify >>>>how many boxes he needs? >>>> >>>> >>>>_______________________________________________ >>>>Rails mailing list >>>>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>http://lists.rubyonrails.org/mailman/listinfo/rails >>> >>>-----BEGIN PGP SIGNATURE----- >>>Version: GnuPG v1.4.1 (Darwin) >>> >>>iD8DBQFDgiOuG9xIoXK+giARAkhkAKDbq9v401QvL1P4OgR/zxf1NPgKWACcDm4i >>>+fuPkSADwsU9m8rijvjO864>>>=9LEk >>>-----END PGP SIGNATURE----- >>>_______________________________________________ >>>Rails mailing list >>>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >>_______________________________________________ >>Rails mailing list >>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>http://lists.rubyonrails.org/mailman/listinfo/rails > >-----BEGIN PGP SIGNATURE----- >Version: GnuPG v1.4.1 (Darwin) > >iD8DBQFDgl8OG9xIoXK+giARAmteAJ9TqnRXYAMdEg6nSrmR20tAQ+rJkwCg+TS5 >oecxF1+HmBrk1gsJVBRGOXw>=J1j1 >-----END PGP SIGNATURE----- >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails
You''ll probably also want to check out the scriptaculous libraries which are mostly eye-candy, but beautiful, wonderful, mouth watering eye candy. As for the prototype library, that thing comes in handy more often than I can count. Couple of links to those libraries: Prototype: http://www.sergiopereira.com/articles/ prototype.js.html#Reference Scriptaculous: http://script.aculo.us Glad it works for you! On Nov 21, 2005, at 4:29 PM, Lieven De Keyzer wrote:> That was indeed the problem. Sorry. I should start reading about > this library I guess. > >> From: Jeff Smick <rails_lists-m0qWdWgHGwnKl/7hFL4KYti2O/JbrIOy@public.gmane.org> >> Reply-To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> Subject: Re: [Rails] Send list of variable size >> Date: Mon, 21 Nov 2005 15:58:06 -0800 >> >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> I just tried it copy pasted and it worked fine. >> Are you sure the prototype library is being included? >> >> <%= javascript_include_tag ''prototype'' %> >> >> should go in at the top of the page. >> >> On Nov 21, 2005, at 2:19 PM, Lieven De Keyzer wrote: >> >>> When I click "Add Another Track" it doesn''t do anything with >>> this code. >>> >>>> From: Jeff Smick <rails_lists-m0qWdWgHGwnKl/7hFL4KYti2O/JbrIOy@public.gmane.org> >>>> Reply-To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>> To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>> Subject: Re: [Rails] Send list of variable size >>>> Date: Mon, 21 Nov 2005 11:44:43 -0800 >>>> >>>> -----BEGIN PGP SIGNED MESSAGE----- >>>> Hash: SHA1 >>>> >>>> With the Prototype javascript library you could do something >>>> like the following: >>>> >>>> <ol id=''tracklist''> >>>> </ol> >>>> >>>> <span id=''track_form'' style=''display:none;''> >>>> <li><%= text_field_tag ''tracks[]'' %></li> >>>> </span> >>>> >>>> <%= link_to_function ''Add Another Track'', "new Insertion.Bottom >>>> (''tracklist'', $(''track_form'').innerHTML)" %> >>>> >>>> That would put a link on the under the tracklist that will add >>>> another form element each time it was clicked. >>>> >>>> On Nov 21, 2005, at 10:48 AM, Lieven De Keyzer wrote: >>>> >>>>> I''m developing some sort of imdb (http://www.imdb.com) >>>>> application for CDs to practice Ruby on Rails. >>>>> So a user should be able to upload information of a CD that''s >>>>> not yet in the database. But I''m wondering what would be the >>>>> possible ways to send information like tracklists. It seems >>>>> to me the easiest way is a form with an input box per track, >>>>> but how let the user easily specify how many boxes he needs? >>>>> >>>>> >>>>> _______________________________________________ >>>>> Rails mailing list >>>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>> >>>> -----BEGIN PGP SIGNATURE----- >>>> Version: GnuPG v1.4.1 (Darwin) >>>> >>>> iD8DBQFDgiOuG9xIoXK+giARAkhkAKDbq9v401QvL1P4OgR/zxf1NPgKWACcDm4i >>>> +fuPkSADwsU9m8rijvjO864>>>> =9LEk >>>> -----END PGP SIGNATURE----- >>>> _______________________________________________ >>>> Rails mailing list >>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >>> >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1.4.1 (Darwin) >> >> iD8DBQFDgl8OG9xIoXK+giARAmteAJ9TqnRXYAMdEg6nSrmR20tAQ+rJkwCg+TS5 >> oecxF1+HmBrk1gsJVBRGOXw>> =J1j1 >> -----END PGP SIGNATURE----- >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails