Forum: Ruby on Rails Send list of variable size

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
lieven_dekeyzer (Guest)
on 2005-11-21 20:49
(Received via mailing list)
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_lists (Guest)
on 2005-11-21 21:46
(Received via mailing list)
-----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:

> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFDgiOuG9xIoXK+giARAkhkAKDbq9v401QvL1P4OgR/zxf1NPgKWACcDm4i
+fuPkSADwsU9m8rijvjO864=
=9LEk
-----END PGP SIGNATURE-----
lieven_dekeyzer (Guest)
on 2005-11-22 00:19
(Received via mailing list)
When I click "Add Another Track" it doesn't do anything with this code.
rails_lists (Guest)
on 2005-11-22 02:00
(Received via mailing list)
-----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:

>> Hash: SHA1
>>
>>> So a user should be able to upload information of a CD that's
>>
>> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid
> 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-----
lieven_dekeyzer (Guest)
on 2005-11-22 02:32
(Received via mailing list)
That was indeed the problem. Sorry. I should start reading about this
library I guess.
rails_lists (Guest)
on 2005-11-22 05:05
(Received via mailing list)
_______________________________________________
Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails
This topic is locked and can not be replied to.