Re: Netscape Form Validation
by Robin Liston <rliston(at)cox.net>
|
Date: |
Thu, 18 Apr 2002 18:24:48 -0700 |
To: |
hwg-techniques(at)hwg.org |
In-Reply-To: |
|
|
todo: View
Thread,
Original
|
|
Is you form enclosed in a layer?
If so, any reference you make to the form elements or the form in NN4 has
to be preceded by document.layer['layer_name']
e.g.
document.layer['layer_name'].document.forms[0].submit()
the above statement won't work in IE, so you'll have to detect the browser
and serve up the appropriate statement.
Also I think NN4 chokes if the form tag is inside of a table.
HTH
At 01:08 AM 04/19/2002 +0000, you wrote:
>>From: Tracy Collingwood <collingw(at)fredonia.edu>
>>To: hwg-techniques(at)hwg.org
>>Subject: Netscape Form Validation
>>Date: Wed, 17 Apr 2002 14:07:35 -0400
>>
>>Hi,
>>
>>We are working on a form that is validating in IE but not in Netscape. You
>>can see the code below. Any ideas as to why the validation is not working
>>in Netscape?
>>
>>Thanks in advance for any help!
>>Tracy
>>
>>< SCRIPT LANGUAGE="JavaScript">
>>< !--
>>
>>function validateForm() {
>>
>> if (Evaluation.classLevel.options[0].selected) {
>> alert('Please select your class level.');
>> event.returnValue=false;
>> document.Evaluation.classLevel.select();
>> document.Evaluation.classLevel.focus();
>> return false;
>> }
>> if (Evaluation.num_sessions.options[0].selected) {
>> alert('Please select the number of sessions you attended.');
>> event.returnValue=false;
>> document.Evaluation.num_sessions.select();
>> document.Evaluation.num_sessions.focus();
>> return false;
>> }
>>
>> var checklist;
>> var i, j, checked;
>>
>> for (i=1;i<=22;i++) {
>> checklist = eval("document.Evaluation.o" + i);
>> checked = 0;
>> for (j=0; j<checklist.length; j++) {
>> if (checklist[j].checked) {
>> checked = 1;
>> break;
>> }
>> }
>> if (!checked) {
>> alert("Please respond to question " + i + ".");
>> checklist[0].focus();
>> return false;
>> }
>> }
>>
>>}
>>
>>// -->
>></SCRIPT>
>
==================================================================
Attention Web Designers and JavaScript, VBScript, and ASP Programmers:
Buy your career related T-Shirts, Coffee Mugs, and Mousepads at
http://www.cafepress.com/cp/store/store.aspx?storeid=utccom,utccom2,utccom3,utccom4
==================================================================
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA