Help: Make all fields in table tag required.

S

Spanky

I am looking for some help with the following.

I have a form with many fields. I have a table in the form that I
need to make all the fields within the table required. Basic
validation, just need to make sure they are not blank.

Here is the kicker....
I have a javascript that adds rows and fields whenever the user clicks
a button for add rows. So, the user clicks button and I add a row
with about 5 fields. Every time a user clicks I add another row.

So, when submitting the form I need to check all fields inside the
table tag ID"TEST".

Any help or guidance is appreciated.

Allen
 
L

lallous

Hi,

when you dynamically add a new input field in the form, do name it as:
MyFieldN
where N ranges fron say 0 to limit.

Later run a loop in document.yourform.elements then check if this element is
of type say 'text' then check its name if it was MyField (using substr()) if
so then do validation on its value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top