Home Answers Viewqa JavaScriptQuestions password and confirm password are same or not Validation

 
 


Sujitha
password and confirm password are same or not Validation
1 Answer(s)      9 months ago
Posted in : JavaScript Questions

Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.

View Answers

August 16, 2012 at 3:44 PM


Here is a code that accepts the current password, New password and conform password from the user and change the password.

1)change.jsp

<html>
<script>
function validate(){
if(document.f.new.value!=document.f.confirm.value){
alert("New Password and Confirm Password should be same! Re-enter confirm-password!");
document.f.confirm.value="";
return false;
}
return true;
}
</script>
<form name="f" action="changePassword.jsp" method="post" onsubmit="return validate();">
<table>
<tr><td>Current Password</td><td><input type="password" name="current" ></td></tr>
<tr><td>New Password</td><td><input type="password" name="new"></td></tr>
<tr><td>Confirm Password</td><td><input type="password" name="confirm"></td></tr>
<tr><td><input type="submit" value="Change Password"></td></tr>
</table>
</form>
</html>

2)changePassword.jsp

<%@page import="java.sql.*"%>
<%@page import="java.io.*"%>
<%
String currentPassword=request.getParameter("current");
String Newpass=request.getParameter("new");
String conpass=request.getParameter("confirm");
String connectionURL = "jdbc:mysql://localhost:3306/test";
Connection con=null;
String pass="";
int id=0;
try{
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(connectionURL, "root", "root");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from login where password='"+currentPassword+"'");
if(rs.next()){
id=rs.getInt(1);
pass=rs.getString(3);
}
System.out.println(id+ " "+pass);
if(pass.equals(currentPassword)){
Statement st1=con.createStatement();
int i=st1.executeUpdate("update login set password='"+Newpass+"' where id='"+id+"'");
out.println("Password changed successfully");
st1.close();
con.close();
}
else{
out.println("Invalid Current Password");
}
}
catch(Exception e){
out.println(e);
}
%>









Related Pages:
Password validation
password and confirm password are same or not Validation  Hi. I have... password and confirm password are same or not. Please help.   Here... Password and Confirm Password should be same! Re-enter confirm-password
Password validation
have to check the values given in the new password and confirm password are same...(){ if(document.f.new.value!=document.f.confirm.value){ alert("New Password and Confirm Password should be same! Re-enter confirm-password!"); document.f.confirm.value=""; return false
Password validation
have to check the values given in the new password and confirm password are same...(){ if(document.f.new.value!=document.f.confirm.value){ alert("New Password and Confirm Password should be same! Re-enter confirm-password!"); document.f.confirm.value=""; return false
Password validation
have to check the values given in the new password and confirm password are same...(){ if(document.f.new.value!=document.f.confirm.value){ alert("New Password and Confirm Password should be same! Re-enter confirm-password!"); document.f.confirm.value=""; return false
Password validation
have to check the values given in the new password and confirm password are same...(){ if(document.f.new.value!=document.f.confirm.value){ alert("New Password and Confirm Password should be same! Re-enter confirm-password!"); document.f.confirm.value=""; return false
password validation with special character
password validation with special character  how to validate password with special character using java script
change password servlets - JSP-Interview Questions
for the confirm password. You also have validation for these text boxes (ex. should not be blank, newpassword and confirm password should be same). In database... and the confirm password should be same. After submiting the page you have to update
Password
Password  make a program which ask ask the username and password * in this format. in C language
Login Password Validation iPhone / iPAD
Login Password Validation iPhone / iPAD  HOW TO WRITE A TEST CASE TO SET THE VALIDATION FOR LOGIN AND PASSWORD FIELD IN OBJECTIVE C, IOS.   @implementation LoginViewTests - (void)testPasswordFieldIsNotEmpty
Developing Forgot Password Form
Developing Forgot Password Form       In this section we will develop Forgot Password Form code for our application. Developing Forgot Password Form  
Username password
with the validation, so that if the username and password match it will continue... that checks whether the username and password is valid or not. If the user...("Password:"); text2 = new JPasswordField(15); SUBMIT=new JButton("SUBMIT
secure password
secure password   Respected Sir We need to write a function which accepts a given password and returns ââ?¬Å?ACCEPTEDââ?¬Â? or ââ?¬Å?REJECTEDââ... sequence of characters immediately followed by the same sequence. please solve
secure password
secure password   Respected Sir We need to write a function which accepts a given password and returns ââ?¬Å?ACCEPTEDââ?¬Â? or ââ?¬Å?REJECTEDââ... sequence of characters immediately followed by the same sequence. please solve
jQuery password validation
jQuery password Validation : jQuery "equalTo: "#password" " is the method to validate or check password if the element is empty (text input... validation we can check that password and verify password are equal.   
change password - JSP-Servlet
for a user. this web page consists of changing the password for the existing user. it look like this: current password new password confirm new password SUBMIT...: 1)change.jsp: Current Password New Password Confirm Password
String Validation
!=document.f.confirm.value){ alert("New Password and Confirm Password should be same! Re... in that I have to check whether the value given in the 2 password fields are same or not. Its for the form changing password. If they are not same it should give
Password History - JSP-Servlet
Password History  I am using servlets and in my application i want to maintain password history.It means on password change My application should check previous 5 password so that new password can't be same to 5 old password
String Validation
!=document.f.confirm.value){ alert("New Password and Confirm Password should be same! Re-enter... to check whether the value given in the 2 password fields are same or not. Its for the form changing password. If they are not same it should give a message
String Validation
){ alert("New Password and Confirm Password should be same! Re-enter confirm... whether the value given in the 2 password fields are same or not. Its for the form changing password. If they are not same it should give a message.   
String Validation
){ alert("New Password and Confirm Password should be same! Re-enter confirm... whether the value given in the 2 password fields are same or not. Its for the form changing password. If they are not same it should give a message.   
Decrypt an encrypted password in JSP
=request.getParameter("confirm_password"); > String > gender...; users(username,password,lastname,email,phone,gender,firstname,confirm_password...Decrypt an encrypted password in JSP   How to decrypt an encrypted
Encrypt Password with JSP - JSP-Servlet
Confirm Password Name Phone Contact 2)encrypt.jsp...Encrypt Password with JSP  Hi guys... I need you help.... I want to ask you how to make encrypt password with JSP servlet. For example I have
Password Field in HTML
Password Field in HTML       When users type characters in a password field, the browser displays asterisks or bullets instead of the characters. Password text field is same
forgot password?
forgot password?  forgot password
Forgot Password Action,Struts Forgot Password Action class
password action requires user name and passwords same as you had entered during... Forgot Password Action       Forgot Password Action The password forgot Action is invoked
validation
validation  How to validate username and password in a login screen
password check
password check  how to check sighup passowrd and login password
change password
change password  how to change password in the login form.... by giving options to user like this old password, new password.. pls help
Reset Password
Reset Password  coding for reset password
retype password
retype password  coding for retype password
forget password?
forget password?  can anyone help me? how to create a module of forget password?the password can reset by generate random password and send to user's email..i develop the php system using xampp and dreamweaver
forget password?
forget password?  can anyone help me? how to create a module of forget password?the password can reset by generate random password and send to user's email..i develop the php system using xampp and dreamweaver
forget password
forget password  codding for forget password using spring framework
Forgot password
Forgot password  hi i want to develop a code for when user clicks on forgot password then the next page should be enter his mobile no then the password must be sent to his mobile no...! Thanks in advance Nag Raj
password change
password change  Hi , I am using jsf and trying to write a code to change the password of a user . Ihave to retrine userid fromdata base how to do that using session
3D PASSWORD
3D PASSWORD  HI i would like to know abt where the 3d password in india used and also few info about the 3d password pls rply some1 as soon as possible
how to change password into one jsp to another jsp
how to change password into one jsp to another jsp  i have two jsps in one jsp i give one password and confirm password, in another jsp i want change...;<td>Confirm Password</td><td><input type="password" name
forget password
forget password  can i get coding for forgot password in jsp, need using javamail also cannot.. what should i do?? Thx
password - JDBC
password  as memeber of our site, recently he forget his password now he want a new password from us. so overcome with this problem i have to send his password to his any emailid to once again login with this new pasword so
password - Security
password  How can i do password encript and decript in java  Hi friend, Code to encript and decript password in java import... password= "Hello"; System.out.println("input " + password
Forget Password
Forget Password  How i get my forget password through mail?   Please visit the following links: http://www.roseindia.net/jsf/richfaces/ http://www.roseindia.net/jsf/richfaces/developing-jsp-files.shtml
Confirm problem
Confirm problem  Sir i have used following code in button delete onclick="if (confirm('sure?')) submit();" and if i choose cancel it still submits the form however if choose cancel i want to remain on same jsp page please help
Spring Security Password Hashing
to generate hash value of the plain text/password ,by using the same folder path where...Spring Security Password Hashing In this section, you will learn about Password Hashing in Spring Security. In the Spring Security Authorized Access Using
validation
;</td> </tr> <tr> <td>Password :</td> <td><form:password path="password" /><...; private String name; private String password; private String gender
Validation
; <b>Password</b> :<input type="Password
Validation
; <b>Password</b> :<input type="Password
form validation
want validation code,username minimum 8 char,password length must >6,and one capital,one small,one special character must.check password and confirm password...; <tr><td>password:</td><td><input type
java password function
java password function  secret password function
password encryption in php - PHP
password encryption in php  example of password encryption in php
Forgot Password of Application
Forgot Password of Application  Forgot Password of Application through servlet and jsp

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.