4 Replies - 298 Views - Last Post: 01 February 2012 - 05:27 AM

Topic Sponsor:

#1 vikasrai  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 31-January 12

Form working in IE Chrome Safari but not working in Mozila

Posted 31 January 2012 - 05:24 AM

Hi all, on my website the query form I put is working on all browser except Mozila. The code is as below please advise where I am doing wrong
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="calendar.css" rel="stylesheet" type="text/css" />
<script src="form-validate-index.js" type="text/javascript" language="javascript"></script>
<script src="calendar_us.js" type="text/javascript" language="javascript"></script>
<script src="langu.js" type="text/javascript"></script>
</head>
<body>

 <div class="form-index">
            <form id="frmindex" name="frmindex" method="post" action="send-index-mail.php" target="_top">
              <input type="hidden" name="txtHref" />
              <input type="hidden" name="txtTitle" />
              <input type="hidden" name="txtReferrer" />
              <input type="hidden" name="txtCookie" />
              <table width="100%" border="0">
                <tr>
                  <td colspan="2" ><input onfocus="if(this.value == 'Name'){this.value = '';}" type="text" onblur="if(this.value == ''){this.value='Name';}" id="name" name="txtName" value="Name" size="25" class="form-index-txt" /></td>
                </tr>
                <tr>
                  <td colspan="2"><input onfocus="if(this.value == 'E Mail ID'){this.value = '';}" type="text" onblur="if(this.value == ''){this.value='E Mail ID';}" id="email" name="txtEmail" value="E Mail ID" size="25" class="form-index-txt"/></td>
                </tr>
                <tr>
                  <td colspan="2"><input onfocus="if(this.value == 'Phone No'){this.value = '';}" type="text" onblur="if(this.value == ''){this.value='Phone No';}" id="phone" name="txtPhone" value="Phone No" size="25" class="form-index-txt"/></td>
                </tr>
                <tr>
                  <td colspan="2"><input onfocus="if(this.value == 'Country'){this.value = '';}" type="text" onblur="if(this.value == ''){this.value='Country';}" id="country" name="txtCountry" value="Country" size="25" class="form-index-txt"/></td>
                </tr>
                <tr>
                  <td width="32%">&nbsp;Arrival</td>
                  <td width="68%"><input name="txtArrv" type="text" size="10" class="form-index-txt" />
                    <script language="Javascript" type="text/javascript">new tcal ({	'formname': 'frmindex','controlname': 'txtArrv'});</script></td>
                </tr>
                <tr>
                  <td colspan="2"><input onfocus="if(this.value == 'Duration'){this.value = '';}" type="text" onblur="if(this.value == ''){this.value='Duration';}" id="duration" name="txtDays" value="Duration" size="25" class="form-index-txt"/></td>
                </tr>
                <tr>
                  <td colspan="2"><input onfocus="if(this.value == 'Adults'){this.value = '';}" type="text" onblur="if(this.value == ''){this.value='Adults';}" id="adults" name="txtAdult" value="Adults" size="9" class="form-index-txt"/>
                    &nbsp;&nbsp;
                    <input onfocus="if(this.value == 'Childs'){this.value = '';}" type="text" onblur="if(this.value == ''){this.value='Childs';}" id="child" name="txtChild" value="Childs" size="9" class="form-index-txt"/></td>
                </tr>
                <tr>
                  <td colspan="2"><textarea name="txtReq"  class="form-index-txt" rows="2" cols="2" style="width:158px;" id="Req" onfocus="if(this.value=='requirement') {this.value='';}" onblur="if(this.value=='') {this.value='requirement';}">requirement</textarea></td>
                </tr>
                <tr>
                  <td><img src="randomImage-index.php" alt="cap"/></td>
                  <td><input name="vercode" type="text"  size="12" class="fields"  /></td>
                </tr>
                <tr>
                  <td colspan="2"><div align="center">
                      <input type="button" onclick="Validate()" title="Submit" value="Submit" class="inside-form-format" />
                      <input type="button" onclick="frmindex.reset();" title="Reset" value="Reset" class="inside-form-format" />
                    </div>

</body>
</html> 


Thanks for your help in advance

Is This A Good Question/Topic? 0
  • +

Replies To: Form working in IE Chrome Safari but not working in Mozila

#2 Sho Ke  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 14
  • View blog
  • Posts: 97
  • Joined: 13-October 11

Re: Form working in IE Chrome Safari but not working in Mozila

Posted 31 January 2012 - 08:39 AM

Can you post your javascript files or send a link to your site? Your submit buton is calling the function Validate() and I'm getting an error saying Validate() is undefined(because I don't have the external javascript files).
Was This Post Helpful? 0
  • +
  • -

#3 vikasrai  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 31-January 12

Re: Form working in IE Chrome Safari but not working in Mozila

Posted 31 January 2012 - 09:13 AM

View PostSho Ke, on 31 January 2012 - 08:39 AM, said:

Can you post your javascript files or send a link to your site? Your submit buton is calling the function Validate() and I'm getting an error saying Validate() is undefined(because I don't have the external javascript files).


Hi Ke , Thanks for your reply. Here is the link of my website and code for the javascript as well .

Site : www.rajasthan-tourpackages.com/index.html
javascript code
function Validate()
{	
	if(frmindex.txtName.value =="")
	{
		alert("Please enter your name");
		frmindex.txtName.focus();
		return;
	}
		if(frmindex.txtEmail.value =="0")
	{
		alert("Please enter your Email Id");
		frmindex.txtEmail.focus();
		return;
	}
	if(frmindex.txtPhone.value =="")
	{
		alert("Please enter Phone No");
		frmindex.txtName.focus();
		return;
	}
	else if (checkmail(frmindex.txtEmail.value) == false)
	{
		alert("Please enter valid Email Id");
		frmindex.txtEmail.focus();
		return;
	}
	
	document.frmindex.txtHref.value = window.location.href;
	document.frmindex.txtTitle.value = document.title;
	document.frmindex.txtReferrer.value = document.referrer;
	document.frmindex.txtCookie.value = document.cookie;
	frmindex.submit();	
}

var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i

function checkmail(eid)
{
	return emailfilter.test(eid)
}


Was This Post Helpful? 0
  • +
  • -

#4 Sho Ke  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 14
  • View blog
  • Posts: 97
  • Joined: 13-October 11

Re: Form working in IE Chrome Safari but not working in Mozila

Posted 31 January 2012 - 10:18 AM

Firefox's Error Console says frmindex is not defined.
I did some fiddling around, and replacing every instance of frmindex... .value with getElementsByTagName("...")

for example:
if(document.getElementsByTagName("txtName").value =="")
	{
		alert("Please enter your name");
		frmEnquiry.txtName.focus();
		return;
	}
	if(document.getElementsByTagName("txtEmail").value =="0")
	{
		alert("Please enter your Email Id");
		frmEnquiry.txtEmail.focus();
		return;
	}
	else if (checkmail(document.getElementsByTagName("txtEmail").value) == false)
	{
		alert("Please enter valid Email Id");
		frmEnquiry.txtEmail.focus();
		return;
	}


I'm in a bit of a time crunch at the moment, though I'll be able to explain in depth what the issue is. Look forward to a reply in a few hours. Sorry!
Was This Post Helpful? 0
  • +
  • -

#5 vikasrai  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 31-January 12

Re: Form working in IE Chrome Safari but not working in Mozila

Posted 01 February 2012 - 05:27 AM

Hi Ke . just to let you know also , the same form works fine in firefox also if doctype is changed to html 4.0 from xhtml 1.0 transitional
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1