<ianv2@aol.com> wrote in message
news:1120144251.513470.39970@o13g2000cwo.googlegroups.com...
> Hi
>
> I have the following form that I need advanced validation on, I would
> appreciate any help please.
>
> How can I validate the form so that the user has to select an option
> from the select box and if they choose 'other' the focus goes to the
> 'otherfeedback' textarea which also has to have a value.
>
> <form action="feedback.cfm" method="post" name="form" id="Form"
> <select size="1" name="aplan">
> <option value="none">-- Select Your Answer --
> <option></option>
>
> <option value="More bulletins">More bulletins</option>
> <option value="Don't know">Don't know</option>
> <option value="Other">Other please specify below</option>
> </select>
> <p>
> <textarea name="otherfeedback" wrap="PHYSICAL" rows="8"
> cols="100"></textarea>
> </p>
> </form>
>
> Thanks in advance for any assistance and time.
>
Is this what you're looking for? Watch for word-wrap.
<html>
<head>
<title>other.htm</title>
<script type="text/javascript">
function other() {
var form = document.form;
if (form.aplan.options[4].selected) {
form.otherfeedback.disabled = false;
form.otherfeedback.focus();
} else {
form.otherfeedback.value = "";
form.otherfeedback.disabled = true;
}
}
</script>
</head>
<body>
<form action="feedback.cfm" method="post" name="form" id="Form">
<select size="1" name="aplan" onchange="other()">
<option value="none">-- Select Your Answer --
<option></option>
<option value="More bulletins">More bulletins</option>
<option value="Don't know">Don't know</option>
<option value="Other">Other please specify below</option>
</select>
<p>
<textarea name="otherfeedback" wrap="PHYSICAL" rows="8" cols="100"
disabled></textarea>
</p>
</form>
</body>
</html>
Received on Tue Oct 18 02:50:26 2005