Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Separate form variables

Status
Not open for further replies.

Csanad

Programmer
Jul 25, 2007
23
0
0
US
Hello,

I have a form:


The idea is that every time the "Add a Dependant Item" button is clicked, the Item whose "Add a Dependant Item" button was clicked will have an additional field for another dependant item. (Thanks to Fehérke!)

Similarly, when the "Add Another Item" button is clicked, the form should have another item with all the usual fields. How do I go about this?

More importantly, when all is said and done and sent to the server, how will the server know which Dependant Item belongs to which Item?

Thanks very much for your time!

Csanád
 
It looks like you've already solved your first issue (clicking the 'Add another item' button seems to do what you want it do.

One thing you are doing very wrong is giving all your new content the same ID. You should never do this - IDs should always be unique. This is the first thing you need to address.

To answer your second question, if you name the fields similarly, the you should have no problem.

Hope this helps,
Dan




Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thanks. I'm working on the first issue.

What do you mean by this: "To answer your second question, if you name the fields similarly, the you should have no problem."

Csanád
 
I mean just what I said. If you name your fields similarly, for example:

'ITEM1_name', 'ITEM1_desc', 'ITEM1_dep1', 'ITEM1_dep2', etc

then you should easily be able to work out server-side what is what.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top