Variable number of fields in Drupal
The problem I'm currently working on is creating nodes in Drupal with a variable number of fields. For example I'd like to have an "officers" list for organizations they might have 1 or 5 or 50. I'd rather not hard code a certain number of fields as a maximum.
Comments
add some DHTML to append new
add some DHTML to append new INPUT fields to your form and have their names+IDs increment as part on array
i=i+1;
somethingsomething.innerHTML=somethingsomething.innerHTML.value+
'<input maxlength="128" name="edit[emailaddress_'+i+']" id="edit-emailaddress" size="30" value="" class="form-text" type="text">';
?
Check out the embed filter
It's settings page lets you add an arbitrary number of items:
http://drupal.org/project/embedfilter
Also CCK lets you have "multiple" field types. It starts out with three, but when you fill those, you get three more.
Same Problem
Did you ever find a solution to this? I am attempting to do the same thing and can't get Drupal to pass me back the values in the dynamic fields. I can get around this by pulling them out of the $_POST array but am trying to avoid circumventing the API.
I posted to the Drupal forums but haven't gotten a responce.
-T

