Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-27-2012, 03:26 AM   PM User | #1
ajb225
New to the CF scene

 
Join Date: Mar 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
ajb225 is an unknown quantity at this point
Dynamic input field generation

Hi all,

I have a complicated (well to me it is!) problem with a form I am creating for my site. The form has three sections with the ability to add another field unlimited times. There is one for adding ingredients, one for equipment and one for steps

The name and id does increment on all 3 however the problem is they seem to all be using the same count, by this I mean that if I add 2 steps (which brings the count to 3) and then add an ingredient, the ingredient id goes to ingredient4 - obviously because it is taking the count that step has set. I am no javascript guru, I am more a designer so I'm really struggling, Ive been working on this one for days..

There is also another problem in that if I create say 3 steps bringing the count up to step4 and then remove the second step, I cant see how I can bring the other steps after step2 count down by one, at the moment step4 and step3 are staying as step3 and step4 but because step2 was removed they should drop down to becoming step2 and step3. My php that inserts the data into my db isnt working because the ids keep getting messed up

I have a demo URL up on ajburchell.com/form.html

If anyone can help me with this I will be extremely grateful

Thank you in advance
ajb225 is offline   Reply With Quote
Old 03-27-2012, 09:27 AM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 530 Times in 524 Posts
devnull69 will become famous soon enough
First of all: Never ever use more than one instance of jQuery on the same page. You are using versions 1.3.2 and 1.6.4 together, which will create problems.

Second: You use the global "var current" several times. Each one overwrites the previous one in that case.

Despite this, when I add two new Ingredient areas and fill out number 3 for example, I can see from the POST request that it was correctly sent as ingredient3. So I don't see the problem
devnull69 is offline   Reply With Quote
Reply

Bookmarks

Tags
dynamic, field, generation, input

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:22 AM.


Advertisement
Log in to turn off these ads.