oops sorry for the confusion... The code is the way you have written it.
so that it will be able to look thru the whole list of my dynamic checkboxes to make sure I have ticked at least one checkbox. But it doesn't seem to work. Is it cos scriptlet is server-side scripting while javascipt is client-side? Is there anyway I can get around it?
I'm not sure exactly what the name of the checkbox is. In your first post it is name="<%= modCode %>" in the full code it is name="modCode" Which is it?
From what I can see you have a list of modules. Each module contains a list of tasks. You generate a checkbox for each task in a module.
My assumption: The validator has to make sure that for each moduleone checkbox is checked.
Now the java/jsp bit. You just need to call this function from your current validSecurityClass() function.
in the case that you only need one checkbox checked out of all of the checkboxes on the page, and it is name="modCode" then this will do the trick:
var checkBoxChecked = validateCheckBoxes(thisForm, "modCode");
If it is name="<%= modCode %>"
you need to generate multiple calls to make sure that for each module, at least one task is clicked:
var checkBoxChecked = "true"; // loop for Each module: checkBoxChecked = checkBoxChecked && validateCheckBoxes(thisForm, "<%= modCode %>");
which will generate code like this:
The final thing I would suggest is to use JSTL for looping rather than scriptlet code. It would be much neater than scriptlet code ;-)
Good luck, evnafets
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com