Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-03-2005, 07:20 AM   PM User | #1
js_coder
New to the CF scene

 
Join Date: Jul 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
js_coder is an unknown quantity at this point
Field verification problem...

Hi,

i have spent hours trying to figure out what the problem was, but never succeeded!
so first things first: I am developping an ecommerce type of website where i have a login page that requires the user a login and a password. Now i am performing all testings on Internet Explorer with no restrictions whatsoever.
I have a javaspript function that checks wether the login field or the password field are empty or not.
So, when testing, i intentionally leave the login field blank, and to this point everything is fine, because the javascript function alerts me and tell me that i have omitted the login field. But...now is where the problem lies. Once i have adjusted to what javascript told me and typed my login, and then purposly leave the login field blank, now javascript will NOT alert me and my identification form will go on to the page that checks login/pwd with my database.
Now here is the relevant code:

first, the form:
<form name="ident" method="POST" action="identification.php" onsubmit="return Check_Identification(this)">
<div align="center">
<p>&nbsp;</p>
<table border="1" cellpadding="0" cellspacing="12" width="260" >
<tr>
<td>Login</td>
<td><input type="text" name="Login"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="text" name="Pwd" ></td>
</tr>
<tr>
<td colspan="2" class="right"><input type="submit" value="Submit" name="Action"></td>
</tr>
</table>
<p>&nbsp;</p>
</div>
</form>


now, on to the javascript function:
<script type="text/javascript">

function Check_Identification(f)
{
var Test=f.elements['Login'];
if (Test.value == "" || isNonVide(Test.value) == false)
{

alert("please enter login");
Test.focus();
return false;
}

var Test=f.elements['Pwd'];
if (Test.value == "" || isNonVide(Test.value) == false)
{
alert("please enter pwd");
Test.focus();
return false;
}

return true;
}
</script>

Got any idea?

Thanks you!
js_coder is offline   Reply With Quote
Old 07-03-2005, 07:37 AM   PM User | #2
Harry Armadillo
Regular Coder

 
Join Date: Feb 2005
Posts: 400
Thanks: 0
Thanked 0 Times in 0 Posts
Harry Armadillo is on a distinguished road
Where's the function isNonVide()?

PS: use [code] tags!
Harry Armadillo is offline   Reply With Quote
Old 07-03-2005, 05:03 PM   PM User | #3
Willy Duitt
Banned

 
Join Date: Sep 2003
Posts: 3,620
Thanks: 0
Thanked 0 Times in 0 Posts
Willy Duitt is an unknown quantity at this point
http://www.webdeveloper.com/forum/sh...ad.php?t=71600
Willy Duitt is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:39 AM.


Advertisement
Log in to turn off these ads.