0

Hello There,

I have a code for validation in a form in Html.
The javascript works perfectly in IE, but doesnt work in firefox.

The code is as follows:

<script type="text/javascript">
function Validate_contact()
      {
	  	var status;
        var err='';
		
		if(document.getElementById('EFirstname').value == '')
        {
             err+='Please Enter Your First Name';
             err+='\n';
             status = false;
        }
        else
        {
             err+= '';
             status = true;
        }
        
        if(document.getElementById('ELastname').value == '')
        {
             err +=  'Please Enter Your Last Name';
             err+='\n';
             status = false;
        }
         else
        {
             err+= '';
             status = true;
        }
        
        if(document.getElementById('EEMail').value == '')
        {
             err +=  'Please Enter Your Email Address';
             err+='\n';
             status = false;
        }
         else
        {
             err+= '';
             status = true;
        }

		var chks1 = document.getElementsByName('BHK[]');
		var hasChecked = false;
		for (var i = 0; i < chks1.length; i++)
		{		
			if (chks1[i].checked)
			{
				hasChecked = true;
				break;
			}
		}
		if (hasChecked == false)
		{
			err+='Please select at least Flat Type Option.';
			 err+='\n';
             status = false;
			
		}
		
		var chks = document.getElementsByName('Area[]');
		var hasChecked = false;
		for (var i = 0; i < chks.length; i++)
		{		
			if (chks[i].checked)
			{
				hasChecked = true;
				break;
			}
		}
		if (hasChecked == false)
		{
			err+='Please select at least one Area Option.';
			 err+='\n';
             status = false;
			
		}

	
	if(document.getElementById('Query').value == '')
        {
             err +=  'Please Enter your Message';
            
             status = false;
        }
         else
        {
             err+= '';
             status = true;
        }
        
        if(status==true)
        {
            return true;
        }
        else
        {
            alert(err);
            return false;
        }
			
		
     }
	 
</script>

Can anyone help.

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by jain4
0

Try changing the variable name status to something else. I think it is an old Javascript reserved word. But I am not sure whether that is the problem..

0

I will try and provide you with the error message. Actually when I have form in HTMl that gets posted to asp form which sends the email.
The html when opens up in Firefox shows no error. When one clicks on submit, the asp file opens up and shows an error but also sends the email.
Will post the error message in some time.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.