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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to checked same values ?

Status
Not open for further replies.

Ngai88

Programmer
Sep 8, 2004
56
US
Hello,

Sorry, I think I posted this question on the JSP forum, I guess this should be in the javascript forum instead. Please Help.

I have a drop box that has a list of all the Recipients. I also have checkboxes for the same list of Recipients. Once a recipient is selected from the drop box, I want the same(matching recipients) recipient's checkbox automatically checked. I am not sure how to do this. Is this something like the following? If not, what is the correct way to do this?

form.<%=MComposeController.RECIPIENT%>[form.<%=MComposeController.SUBJECT%>.value].checked


Thanks,
Ngai
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Below is the javascript for it...


<script type="text/javascript">
function verifyForm(form) {
var error = "Error(s):\n\n";
if (form.<%=MComposeController.SUBJECT %>.value == "") {
error += "<%=MComposeController.SUBJECT %> is a required field.\n";
}
var hasRecipient;

for(i=0; i < form.<%=MComposeController.RECIPIENT %>.length; i++) {
if (form.<%=MComposeController.RECIPIENT %>.checked) {
hasRecipient = true;
break;
}
}
if (!hasRecipient) {
error += "<%=MComposeController.RECIPIENT %> is a required field.\n";
}
if (error != "Error(s):\n\n") {
alert(error);
return false;
}
}
</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top