Validation in IE ok, ignored in Netscape?

Results 1 to 2 of 2

Thread: Validation in IE ok, ignored in Netscape?

  1. #1
    Rhys Guest

    Default Validation in IE ok, ignored in Netscape?

    &nbsp;<BR><BR><BR>Hi, The validation on these forms are OK in IE but are ignored in Netscape, could you suggest any solutions?<BR>Thanks<BR>Rhys

  2. #2
    Min Guest

    Default RE: Validation in IE ok, ignored in Netscape?

    Hi,<BR>IE and Netscape implement their document object model differently. The problem with your code is that you put the form in a &#060;div id="text"&#062;&#060;/div&#062;. A &#060;div&#062;&#060;/div&#062; creates a layer within a document object in NetScape. If you want to access an object in a layer , you have to refer to the layer also. In your validate function, you have to access the form like this for Netscape: document.layers["text"].document.forms[0], HOWEVER, this will cause problems for IE on the other hand.<BR><BR>You can use one of the following two ways to get around this problem.<BR>1. Just DO NOT put the form in the div tags.<BR>2. since you have already passed the form reference as a parameter to the validate function, why not just use that reference within your function:<BR> function validate(theForm) {<BR> <BR> if the employee radio button is set<BR> if (theForm.Emp_type[1].checked) {<BR>// and the employee number is blank<BR> if (theForm.elements[2].value == "") {<BR> alert("Please enter you Employee number")<BR>// put cursor in the employee number field<BR> theForm.elements[2].focus()<BR>// The form didn&#039t validate<BR> return false<BR> }<BR> } else {<BR>// theForm.submit()<BR> }<BR>// The form validates<BR><BR> return true<BR>}<BR><BR><BR>Hope this will help.<BR>Good luck.<BR>Min<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts