Ajax Talk - Asynchronous javascript and xml discussion board
 FAQ   Search    Usergroups      Register   Profile   Check your messages   Log in 
Signup now to enjoy a range of free membership advantages !!
Ajax Talk - Moderators Wanted
Adding Form Elements

 
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help
View previous topic :: View next topic  
Author Message
aezell
New one
New one


Joined: 27 Sep 2006
Posts: 2
Location: Franklin, TN, USA

PostPosted: Wed Sep 27, 2006 9:03 pm    Post subject: Adding Form Elements Reply with quote

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?
Back to top
View user's profile Send private message Visit poster's website
Snyke
Forum Assistant
Forum Assistant


Joined: 20 Jun 2006
Posts: 87
Location: Zurich

PostPosted: Thu Sep 28, 2006 11:38 am    Post subject: Reply with quote

I'm not sure that director[] can be used as a name for the field, as far as I know this only works for checkboxes whereas other fields have to have real, ful names. Try adding an index into the brackets.
_________________
[::[ Snyke.net ]::]
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
aezell
New one
New one


Joined: 27 Sep 2006
Posts: 2
Location: Franklin, TN, USA

PostPosted: Thu Sep 28, 2006 1:55 pm    Post subject: Reply with quote

The "director[]" seems to work because I am getting the data entered in the field that is in the form originally. It is stuffed into the "director" array as one might expect.

It's the fields that are inserted via Ajax that are not included in the array.
Back to top
View user's profile Send private message Visit poster's website
Snyke
Forum Assistant
Forum Assistant


Joined: 20 Jun 2006
Posts: 87
Location: Zurich

PostPosted: Thu Sep 28, 2006 5:34 pm    Post subject: Reply with quote

Ok, I thought it may be the way that Firefox serializes the form data into a request but this doesn't sound like it.
Do you have a working example, it's always easier to see things ^^
_________________
[::[ Snyke.net ]::]
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 Advertisements
 XML & Copyright Notice 
    


Powered by phpBB © 2001, 2005 phpBB Group

What is according to Wikipedia: Ajax Web2.0 XML E4X


Link to our site:

  


del.icio.us digg spurl wists simpy newsvine blinklist furl blogmarks yahoo! myweb smarking ma.gnolia segnalo reddit fark technorati cosmos


Normal Bookmark


Partner Button Links:
Codecrunch.com: Webmaster Tutorials    One Ajax


Partner Text Links:
quomon | web20log | ajaxmatters | tableless | 456bereastreet | music charts | gift ideas | competitions | free xbox 360 | link trade ?


Credits:
it consultancy & project management lead generation zoekmachine optimalisatie steal these buttons seo expert