Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack Thread Tools
Old October 3rd, 2005, 05:28 PM   #1
New Member
 

Join Date: Oct 2005
Location: Anna TX
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 chuckcampbell is on a distinguished road
Else and alerts

Question- I have a page where a user can create a username and password. The username and password is stored in an access database. When the user hits submit on the fist page it calls an asp page that enters it in the access database. The issue I have is with verifying the passwords. I get it to popup the error when the passwords don’t match but I can get it to reset the page so the user can reenter there information. This is the code I’m user

<html>
<head>
<title>Account Create</title>
<script language="javascript">
<!--
function checkMe()
{
if (document.myForm.T2.value == document.myForm.T3.value)
{
document.myForm.PWD.value=document.myForm.T2.value ;
document.myForm.submit();
}
else
alert("Passwords do not match!");
}
//-->
</script>
<meta name="Microsoft Theme" content="safari 011">
</head>

<body>

<p style="background-color: #FF0000; color: #FF0000"></p>

<p align="center">Please enter your Email Address and password.</p>

<form method="POST" name="myForm" action="M_Create_account.asp">
<input type="hidden" name="PWD">
<table border="5">
<tr>
<td>Email Address</td>
<td><input type="text" name="T1" size="20"></td>
</tr>
<tr>
<td bordercolorlight="#FF0000" bordercolordark="#FF0000">Password</td>
<td bordercolorlight="#FF0000" bordercolordark="#FF0000"><input type="password" name="T2" size="20"></td>
</tr>
<tr>
<td>Repeat Password</td>
<td><input type="password" name="T3" size="20"></td>
</tr>
<tr>
<td colspan="2" align="center" bordercolorlight="#FF0000" bordercolordark="#FF0000">
<p align="center">
<input type="submit" onClick="checkMe()" value="Submit" name="account.asp">
<input type="reset" value="Reset">
</p>
</td>
</tr>
</table>
</form>
<p align="center" style="background-color: #FF0000; color: #FF0000"></p>
</body>
</html>
chuckcampbell is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 3rd, 2005, 05:41 PM   #2
New Member
 

Join Date: Sep 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 rpgfan3233 is on a distinguished road
Code:
else {
alert("Passwords do not match!");
document.forms['myForm'].reset();
}
should work.
rpgfan3233 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 4th, 2005, 09:26 AM   #3
New Member
 

Join Date: Oct 2005
Location: Anna TX
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 chuckcampbell is on a distinguished road
Else and alerts

I added the lines but it still didn’t work. It popup the error that the passwords don’t match but It does resets fields. I’m not sure about the open and close brackets.
}
else
alert("Passwords do not match!");
document.forms['myForm'].reset();
}
chuckcampbell is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 4th, 2005, 10:54 AM   #4
New Member
 

Join Date: Sep 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 rpgfan3233 is on a distinguished road
Code:
function checkMe()
{

if (document.myForm.T2.value == document.myForm.T3.value)
{
document.myForm.PWD.value=document.myForm.T2.value;
document.myForm.submit();
}
else
{
alert("Passwords do not match!");
document.forms['myForm'].reset();
}

}
That should help a bit more.
rpgfan3233 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 4th, 2005, 03:44 PM   #5
New Member
 

Join Date: Oct 2005
Location: Anna TX
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 chuckcampbell is on a distinguished road
Else and alerts

I copied and pasted your suggestion and it’s still not working. I get the Pop up that the passwords don’t match, instead of resetting the form it brings me to the next page saying no updates and give me a lick to my next page.
chuckcampbell is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 4th, 2005, 04:07 PM   #6
New Member
 

Join Date: Sep 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 rpgfan3233 is on a distinguished road
In the else{} block, add to the end:
return false;


That might fix it. . .
rpgfan3233 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 4th, 2005, 05:15 PM   #7
New Member
 

Join Date: Oct 2005
Location: Anna TX
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 chuckcampbell is on a distinguished road
Still no good, I tried with the return at the end and I also tried with it in the middle as you can see. Thanks for your help on this.

<!--
function checkMe()
{

if (document.Account_Create.T2.value == document.Account_Create.T3.value)
{
document.Account_Create.PWD.value=document.Account _Create.T2.value;
document.Account_Create.submit();
}
else
{
alert("Passwords do not match!");
return false;
document.forms['Account_Create'].reset();
}

}
chuckcampbell is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 5th, 2005, 01:16 AM   #8
New Member
 

Join Date: Sep 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 rpgfan3233 is on a distinguished road
I asked someone to move this topic to the JavaScript forum since this should be a topic for that forum. I'm currently out of ideas. I hope you get more help there. :-)
rpgfan3233 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 5th, 2005, 02:44 PM   #9
New Member
 

Join Date: Oct 2005
Location: Anna TX
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 chuckcampbell is on a distinguished road
Else and alerts

Thanks rpgfan3233


I just noticed that it does clear the form but instead of staying on the same page it jump to the next page, how do I get it not to jump to the next page?
chuckcampbell is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks

Tags
else , alerts


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

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Alerts: Only one wanted - How to? jswebdev JavaScript 4 December 17th, 2006 05:03 PM
Please help me add some random alerts to my code meddow JavaScript 0 November 23rd, 2006 09:04 PM


Search Engine Optimization by vBSEO 3.2.0 RC8