SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot Taranis's Avatar
    Join Date
    Aug 2002
    Location
    Franklin, TN
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adding Form Elements

    I have a form that handles some basic registration stuff and it has a field for providing the name of the Director. I wanted to give the user the ability to add multiple Directors if they needed. So, I used my handy Prototype and wrote this:

    Code:
    function addDirector() {
     		new Insertion.After('director', '<tr><td><label for="director">Director</label></td><td><input type="text" id="director[]" /></td></tr>');
     	}
    which is fired by clicking a link next to the existing field in the form.

    However, when I do this, any data in that new field is not submitted with the form.

    How do I add fields to the form dynamically with Prototype or Scriptaculous and still have their data submitted with the form?

  2. #2
    SitePoint Zealot Taranis's Avatar
    Join Date
    Aug 2002
    Location
    Franklin, TN
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Solved my own problem here. It is not a problem with the Javascript. It is the fact that I don't have the "name" attribute in the HTML, only the "id" on the input field.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •