Cross - Browser input field problems 
Author Message
 Cross - Browser input field problems

I have created the following script as a generic routine to handle mandatory
fields on an input form. All mandatory fields are suffixed with the
following three letters "_MF". For example, Name_MF, Age_MF, etc. Each form
calls the following method to check whether or not the user has filled in
these fields.

function checkForBlanks()
{

 var nElements
 var strObjectName
 var strObjectVal
 var nMissingFields

file://store the number of elements on form to variable nElements
 nElements = document.forms[0].length;
 nMissingFields=0
 // loop through each element in the form
 for (x=0; x<nElements; x++)
 {
  // store relevant values into variables
  strObjectName = document.forms[0].elements[x].name
  strObjectVal=document.forms[0].elements[x].value

  alert(strObjectName)
  alert(strObjectVal)
  // test for blank mandatory field.
  if
((strObjectName.substring(strObjectName.length-3,strObjectName.length)=="_MF
") && ((strObjectVal=="") || (strObjectVal==null)))
   {
    alert("Some of the mandatory input boxes (Denoted by an asterisk) are
blank. Please complete them before continuing.");
    return (false);
   }
 }
  return (true);

Quote:
}

The script works wonderfully well in IE4 but I am experiencing problems ins
Opera and Netscape Navigator.

Does anybody know why Opera returns "null" for every element in the form,
whilst Netscape sees all the values except for those in a select drop down
list and Internet Explorer has no problem what-so-ever?

Thanks Mark

--

http://www.*-*-*.com/




Fri, 29 Mar 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. removing and replacing cross-reference field codes to text

2. cross-browser scripting

3. Setting background color - cross-browser?

4. cross browser objects

5. Cross Browser Compadabillity

6. cross browser linking

7. cross browser java detection

8. Cross-browser Drop-Down Lists

9. cross browser drag and drop using Javascript

10. Cross Browser Implementation, Help!

11. cross-browser DHML warriors needed..

12. Sarissa, a cross browser JS API for DOM extentions

 

 
Powered by phpBB® Forum Software