|
-
Apr 1st, 2005, 03:56 AM
#1
Thread Starter
Member
Using Javascript in .NET
Hi,
i need to validate my form using javascript... how it can be done...
For eg take a change password screen which prompts for old password, new password and confir new password.. i need to validate whether the new password and confirm new password are same..
Thanks in adv
venkat
venkat
Strength is Life, Weakness is Death
- Swami Vivekananda
-
Apr 1st, 2005, 04:06 AM
#2
Re: Using Javascript in .NET
-
Apr 1st, 2005, 04:10 AM
#3
Member
Re: Using Javascript in .NET
meh, I was bored, asside from the given links, maybe you can do away with this example:
PHP Code:
<html>
<head>
<script type="text/javascript">
function passMatch(e)
{
var pass = e.pass;
var confirmPass = e.confirmPass;
if(pass.value != confirmPass.value || pass.value == "")
{
alert("Your passwords do not match!");
pass.select();
return false;
}
else
{
return true;
}
}
</script>
</head>
<body>
<form name="myForm" action="" method="" onsubmit="return passMatch(this);">
Old Password:<input type="password" name="oldPass"><br>
New Password:<input type="password" name="pass"><br>
Confirm new Password:<input type="password" name="confirmPass"><br>
<input type="submit" value="Change password">
</form>
</body>
</html>
-
Apr 1st, 2005, 04:16 AM
#4
Thread Starter
Member
Re: Using Javascript in .NET
Thanks man...
but i'm using <asp:textbox> how to capture this using javascript while submitting the form
venkat
Strength is Life, Weakness is Death
- Swami Vivekananda
-
Apr 1st, 2005, 04:24 AM
#5
Member
Re: Using Javascript in .NET
The id would be the same as the name, so if your text box id's are 1 and 2:
PHP Code:
var pass = e.TextBox1;
var confirmPass = e.TextBox2;
-
Apr 1st, 2005, 04:26 AM
#6
Re: Using Javascript in .NET
You can use the CompareValidator control, and use it to check whether they both have the same value.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|