Extjs Form: Change Password

In the previous tutorial: Login Extjs-Confirm Password , when a user has successfully logged in, then he will go to this page. In this page a user can change his password because there is a session id to identify its.

OK.. this is the screen shot of this tutorial

change1

The following are some of the files you need to create this tutorial.

1. Create php file

session_start();
include "koneksi.php";
if($_SESSION['name']=='')
{
header("location: index.html");
}

?>




2. Create javascript file

Ext.onReady(function(){
Ext.QuickTips.init();

// Create a variable to hold our EXT Form Panel.
// Assign various config options as seen.
var login = new Ext.FormPanel({
labelWidth:130,
url:'changepswd.php',
frame:true,
title: 'please',
collapsible:true,
width:320,
autoHeight:true,
bodyStyle: 'padding: 10px 10px 0 20px;',
padding:200,
modal: true,
defaultType:'textfield',
monitorValid:true,

// Specific attributes for the text fields for username / password.
// The "name" attribute defines the name of variables sent to the server.
items:[{
fieldLabel:'Old Password',
name:'OldPassword',
inputType: 'password',
allowBlank:false
},{
fieldLabel:'New Password',
name:'NewPassword',
inputType:'password',
allowBlank:false
}],

buttons:[{
text:'Save',
handler:function(){
login.getForm().submit({
method:'POST',
waitTitle:'Please wait.......',
waitMsg:'Send data...',

success:function(){
Ext.Msg.alert('Status', 'success bro.......!', function(btn, text){

login.getForm().reset();
});

},

failure:function(form, action){
if(action.failureType == 'server'){
obj = Ext.util.JSON.decode(action.response.responseText);
Ext.Msg.alert('Chage Password!', obj.errors.reason);
}else{
Ext.Msg.alert('Warning!', 'Authentication server is unreachable : ' + action.response.responseText + "abcd");
}
login.getForm().reset();
}
});
}
},
{

text: 'Reset',
handler:function()
{
login.getForm().reset();
}

}]
});

var createwindow = new Ext.Window({
frame:true,
title:'Change Password',
width:330,
height:250,
closable: false,

items: login
});

createwindow.show();

});

3.  Create php file

include "koneksi.php";
session_start();
$oldpassword = $_POST["OldPassword"];    ;
$newpassword = $_POST["NewPassword"];
$query = "select password from formlogin where password='$oldpassword'";
$sql = mysql_query($query);
$ada = mysql_fetch_row($sql);

if($ada>1){
$query = "update formlogin set password='$newpassword' where id_user = '".$_SESSION['id']."'";
$sql = mysql_query($query);
echo "{success: true}";
} else {
echo "{success: false, errors: { reason: 'change password failur...' }}";
}
?>

Some other file, you can read here: Login Extjs-Confirm Password

Download Source code

Tags: , , , , , , , , , , , , , , , , , , , , ,

Incoming search terms for the article:

extjs confirm password , extjs form submit wait , Extjs Form , ext js form password , title : variable extjs , extjs submit form response , extjs submit how get response , form submit examples extjs , get form by id javascript extjs , get Form() extjs , variables sessions en extjs , getform submit extjs , getForm() submit( extjs , getForm() submit( POST , how to reset some elements of a form extjs , variable php extjs echo username , new page on submit extjs form action , paging on form extjs , php extjs changes , user form in extjs in php , querz textfield from form ext js , Resetting the form values in ExtJs , extjs set modal color , extjs save data form in db , extjs sample password , change password form php , change password module in extjs , change store ext js , coba salah satu , Ext FormPanel submit response , extjs 2 2 form submit , extjs changer form url , align form submit in extjs , extjs form show login , extjs form submit please wait , extjs form submit response , extjs form submit success false , extjs getForm submit , ExtJS how to save to a file , extjs input form password change , extjs inputtype file reset , extjs on change form , button reset form extjs extjs themes , extjs file upload , extjs theme , extjs upload , extjs upload file , extjs grid checkbox , extjs tutorial , extjs login , extjs grid paging , extjs login form extjs checkbox readonly , checkbox row extjs , upload image extjs mysql , extjs file upload tutoriel , tutoriel extjs , extJS checkbox datastore , FileUploadField extjs documentation , icon-user-delete extjs , getSelectionModel() getSelections(); , register extjs application 

One Response to “Extjs Form: Change Password”

  1. Heri a.k.a Bang Rausin says:

    Mas Faisal,
    saya dah coba salah satu sample update password.
    ada kendala nih

    pas klik SAVE, responnya loading ‘Send Data’ terus-terusan n ga mau show message alert nya.
    Tapi Data ke Update.
    knapa ya ???

Leave a Reply

Security Code: