User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 361,627 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,193 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 3157 | Replies: 11
Reply
Join Date: Jul 2006
Posts: 6
Reputation: orr16875 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
orr16875 orr16875 is offline Offline
Newbie Poster

Troubleshooting js doesn't work on IE7 and/or vista

  #1  
Dec 30th, 2007
I have simple js form validation, and it doesn't work, no matter how enabled the browser is. I've tried everything. I even tried: <form action="mailto:..." > but it'll popup the windows alert about using the email program (outlook/outlook express) completely ignoring the js validation.

please your help.

this is the file:

[code=language]
<!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" lang="en" xml:lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>form test</title>

<script type="text/javascript">
<!--
document.write("If this text is displayed, your browser supports scripting!")

function validate(thisForm)
{
if(thisForm.Fname.value=="")
{
alert("Please enter first name");
thisForm.Fname.focus();
return false;
}
if(thisForm.Lname.value=="")
{
alert("Please enter last name");
thisForm.Lname.focus();
return false;
}
return true;
}
//-->
</script>
<noscript>JavaScript is NOT enabled!</noscript>

</head>
<body>
<form action="mail.php" name="thisForm" id="thisForm" method="post" onsubmit="return validate(thisForm)" enctype="text/plain">

<p>First Name <input type="text" name="Fname" id="Fname" size="30" maxlength="25" /></p>
<p>Last Name <input type="text" name="Lname" id="Lname" size="30" maxlength="25" /></p>
<p>Password &nbsp;&nbsp;<input type="password" name="psswd" size="30" maxlength="8" /></p>

<h4>your favorite food</h4>
<p><input type="checkbox" name="food" value="pizza" checked="checked" />Pizza<br />
<input type="checkbox" name="food" value="chicken" />chicken<br />
<input type="checkbox" name="food" value="eggs" />eggs<br /></p>

<h4>Your gender</h4>
<p><input type="radio" name="gender" value="female" checked="checked" />female<br />
<input type="radio" name="gender" value="male" />male<br /></p>

<p><input type="submit" value="send" /><input type="reset" value="clear" /></p>
</form>

<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88" /></a></p>

</body></html> [code]
Last edited by orr16875 : Dec 30th, 2007 at 11:55 pm.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2007
Posts: 2,354
Reputation: MidiMagic is on a distinguished road 
Rep Power: 6
Solved Threads: 89
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Nearly a Posting Maven

Re: js doesn't work on IE7 and/or vista

  #2  
Jan 1st, 2008
It's a security setting.
Daylight-saving time uses more gasoline
Reply With Quote  
Join Date: Jul 2006
Posts: 6
Reputation: orr16875 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
orr16875 orr16875 is offline Offline
Newbie Poster

Re: js doesn't work on IE7 and/or vista

  #3  
Jan 1st, 2008
thanks for your response.

yes, but now all radio button in internet-security are enabled and still i have this problem.
Reply With Quote  
Join Date: Nov 2007
Posts: 23
Reputation: chrelad is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 3
chrelad's Avatar
chrelad chrelad is offline Offline
Newbie Poster

Solution Re: js doesn't work on IE7 and/or vista

  #4  
Jan 1st, 2008
Hi orr16875,

Security has nothing to do with it as far as I can tell... We are just refering to the DOM elements incorrectly.

Check it out, changed parts are bolded:

<!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" lang="en" xml:lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>form test</title>

<script type="text/javascript">
<!--
document.write("If this text is displayed, your browser supports scripting!")

function validate(el)
{
  if(el.Fname.value=="")
  {
    alert("Please enter first name");
    el.Fname.focus();
    return false;
  }
  if(el.Lname.value=="")
  {
    alert("Please enter last name");
    el.Lname.focus();
    return false;
  }
  return true;
}
//-->
</script>
<noscript>JavaScript is NOT enabled!</noscript>

</head>
<body>
<form action="mail.php" name="thisForm" id="thisForm" method="post" enctype="text/plain" onSubmit="return validate(this);">

<p>First Name <input type="text" name="Fname" id="Fname" size="30" maxlength="25" /></p>
<p>Last Name <input type="text" name="Lname" id="Lname" size="30" maxlength="25" /></p>
<p>Password &nbsp;&nbsp;<input type="password" name="psswd" size="30" maxlength="8" /></p>

<h4>your favorite food</h4>
<p><input type="checkbox" name="food" value="pizza" checked="checked" />Pizza<br />
<input type="checkbox" name="food" value="chicken" />chicken<br />
<input type="checkbox" name="food" value="eggs" />eggs<br /></p>

<h4>Your gender</h4>
<p><input type="radio" name="gender" value="female" checked="checked" />female<br />
<input type="radio" name="gender" value="male" />male<br /></p>

<p><input type="submit" value="send" /><input type="reset" value="clear" /></p>
</form>

<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88" /></a></p>

</body></html>

Works in IE and Firefox!
Reply With Quote  
Join Date: Jul 2006
Posts: 6
Reputation: orr16875 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
orr16875 orr16875 is offline Offline
Newbie Poster

Re: js doesn't work on IE7 and/or vista

  #5  
Jan 1st, 2008
thanks Chrelad for your response.

I've made the changes like you suggested but still no luck.
Last edited by orr16875 : Jan 1st, 2008 at 11:57 pm.
Reply With Quote  
Join Date: Nov 2007
Posts: 23
Reputation: chrelad is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 3
chrelad's Avatar
chrelad chrelad is offline Offline
Newbie Poster

Question Re: js doesn't work on IE7 and/or vista

  #6  
Jan 2nd, 2008
Hi orr16875,

Hmmm, well, sorry about misleading you there. Could you provide us with an error or anything that seams amiss?

Thanks orr16875
Reply With Quote  
Join Date: Jul 2006
Posts: 6
Reputation: orr16875 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
orr16875 orr16875 is offline Offline
Newbie Poster

Solution Re: js doesn't work on IE7 and/or vista

  #7  
Jan 2nd, 2008
it's ok, you're trying to help me.

amm, when i click the form_test.html file it will show up. I leave it blank and click "submit", it'll open a new page - the mail.php, and won't show up the content of thakyou.htm file.
Reply With Quote  
Join Date: Nov 2007
Posts: 23
Reputation: chrelad is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 3
chrelad's Avatar
chrelad chrelad is offline Offline
Newbie Poster

Question Re: js doesn't work on IE7 and/or vista

  #8  
Jan 2nd, 2008
Hi orr16875,

It appears that I'm still able to get it to work... What version of IE7 are you running (Help -> About Internet Explorer -> Version: XXXXXXX)?

Here's an image of it working on my IE7 install version 7.0.5730.13.

http://img216.imageshack.us/my.php?i...eenshotjg0.png
Reply With Quote  
Join Date: Aug 2007
Posts: 50
Reputation: Fest3er is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 2
Fest3er Fest3er is offline Offline
Junior Poster in Training

Re: js doesn't work on IE7 and/or vista

  #9  
Jan 2nd, 2008
Moving the script and noscript tags and content inside the body (where they belong), and changing onSubmit to onsubmit makes the file Valid XHTML 1.0 Transitional (according to w3.org).

Either way, the file works on Konqueror and Iceweasel on Debian/Linux.
Reply With Quote  
Join Date: Jul 2006
Posts: 6
Reputation: orr16875 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
orr16875 orr16875 is offline Offline
Newbie Poster

Re: js doesn't work on IE7 and/or vista

  #10  
Jan 6th, 2008
i've moved the <script> to body. the onsubmit is same.

the IE7 version is: 7.0.6000.16575

it works on FF2, yeeeee

but still doesn't work IE7. still need your help.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 6:37 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC