I've pulled together an online form that creates a number of tables dependant on the results of a dropdown list, i.e. 2 from the list creates two input tables, 10 creates 10 tables etc.
The script for creating the tables is as follows;
This is fine and the php page that is actioned upon validation can see the information from all the various tables.
What i need though is some validation for the boxes, namely, that if there is a table then the locbox[] field has to have text in it.
Each time I've tried to write the validation part for this section it says that "locbox" isn't defined, yest it is (as in the script above).
Any help at clearing this up and simplifying arrays would be greatly, muchly, enormously appreciated.
The script for creating the tables is as follows;
Code:
<script type="text/javascript"><!-- function fboxes(NumberOfBoxes){ var i,boxes=''; for(i=0; i<NumberOfBoxes; i++){ boxes += "<table width='400' border='0' cellspacing='0' cellpadding='0' align='left'><tr><td><strong>Location</strong></td><td><input type='textarea' name='locbox["+i+"]' id='locbox["+i+"]' size='30'></td></tr><tr><td colspan='2'><div align='center'><strong>Incident Details</strong></div></td></tr><tr><td colspan='2'><textarea name='textbox["+i+"]' id='textbox["+i+"]' cols='35' rows='8'></textarea></td></tr><tr><td colspan='2'><div align='center'><strong>Business Impact</strong></div></td></tr><tr><td colspan='2'><textarea name='bimpbox["+i+"]' id='bimpbox["+i+"]' cols='35' rows='8'></textarea></td></tr></table>"; } document.getElementById('currentissues').innerHTML = boxes; } --></script>
What i need though is some validation for the boxes, namely, that if there is a table then the locbox[] field has to have text in it.
Each time I've tried to write the validation part for this section it says that "locbox" isn't defined, yest it is (as in the script above).
Any help at clearing this up and simplifying arrays would be greatly, muchly, enormously appreciated.
Comment