|
Any help with this is greatly appreciated: I need it to require text be entered into the textbox (name=Additional_Info) if the checkbox (name=Problem value=Other) is checked. I keep getting errors and don`t know what is causing the hang up. If you would like to see how the whole page works go to http://www.wattscopy.com/services/service_new.htm
Below is my script so far:
<script language="javascript">
<!--
function CheckForm() {
// require at least one checkbox be selected
var checkboxSelected = false;
for (i = 0; i < Service.Problem.length; i++)
{
if (Service.Problem.checked)
checkboxSelected = true;
}
if (!checkboxSelected)
{
// require text if "Other" checkbox checked
alert("Please select a checkbox to describe the problem you are
experiencing. If your issue is not listed please check \"Other\" and
describe in the text box.");
return (false);
}
if (document.Service.Problem.value == "Other") {
if (isempty(Additional_Info.value)) {
alert("Please enter your comments here.");
document.Service.Additional_Info.focus();
}
}
//-->
</script>
Kevin
|
|
|
>for (i = 0; i < Service.Problem.length; i++)
>{
>if (Service.Problem.checked)
try
if (Service.Problem.checked)
|
|
|
the square brackets are missing :/
if (Service.Problem`square bracket left`i`square bracket right`.checked)
|
|
|
|
|
|
|
|