Webskater
10-08-2003, 03:17 AM
I have a dynamically created table - so it might have 5 columns and 6 rows or 3 columns and 20 rows. Each cell has a checkbox in it. Before allowing a form to be submitted I need to check that at least one check box in each column and one check box in each row is checked.
At the moment I am looping through the rows checking the status of each checkbox in each column and checking one of them is checked - and then looping through the columns checking at least one checkbox in each row is checked. It works but it seems a big ugly. My checkbox is called 'Assign'. I know how many Assign elements I have, how many rows and how many columns. I think there must be a way of looping through the 'Assign' elements creating arrays based on the column length and/or row length and then doing the checks. Unfortunately, the mind is willing but the brain is feeble. Can anyone point me in the right direction on this? Thanks for any help.
At the moment I am looping through the rows checking the status of each checkbox in each column and checking one of them is checked - and then looping through the columns checking at least one checkbox in each row is checked. It works but it seems a big ugly. My checkbox is called 'Assign'. I know how many Assign elements I have, how many rows and how many columns. I think there must be a way of looping through the 'Assign' elements creating arrays based on the column length and/or row length and then doing the checks. Unfortunately, the mind is willing but the brain is feeble. Can anyone point me in the right direction on this? Thanks for any help.