CODE
var RegistrationView = new KONtx.Class({
ClassName: 'RegistrationView',
Extends: KONtx.system.SidebarView,
createView: function() {
var password;
this.controls.backButton = new KONtx.control.BackButton({
label: "Back",
guid: "back_button",
styles: {
width: this.width
}
}).appendTo(this);
})
this.controls.usernameButton = new KONtx.control.TextEntryButton({
guid: 'Username',
label: 'Username',
styles: {
vOffset: this.controls.backButton.outerHeight
}
}).appendTo(this);
this.controls.passwordButton = new KONtx.control.TextEntryButton({
guid: 'Password',
label: 'Password',
secureMask: true,
secureMaskType: 'mask-all',
styles: {
vOffset: this.controls.usernameButton.outerHeight
},
events: {
onSubmit: function(event) {
log($dump(event));
log($dump(event.payload));
log(event.payload.value);
this.password = event.payload.value;
var dialog = new KONtx.dialogs.Alert({
title: "Dialog Title",
message: this.password,
buttons: [{
label: "Ok",
callback: function(){
}
}],
cancelCallback: function() {
log("Dialog was canceled by the user by hitting the back button");
}
});
dialog.show();
}
}
}).appendTo(this);
this.controls.confirmPasswordButton = new KONtx.control.TextEntryButton({
guid: 'confirmPass',
label: 'Confirm Password',
secureMask: true,
secureMaskType: 'mask-all',
data: 'test',
styles: {
vOffset: this.controls.passwordButton.outerHeight
}
}).appendTo(this);
this.controls.submitButton = new KONtx.control.TextButton({
label: 'Register',
styles: {
width: 294,
height: 25,
textAlign: "left",
vOffset: this.controls.nameButton.outerHeight
}, //Style information for the Button stored in our 960x540.js file
events: {
//Setup a onSelect Event to handle the button action
onSelect:function(event){
//var password = this.getView().controls.passwordButton.value;
var cPassword = this.getView().controls.confirmPasswordButton.value;
var dialog = new KONtx.dialogs.Alert({
title: "Dialog Title",
message: this.password,
buttons: [{
label: "Ok",
callback: function(){
log("User said everything is a-ok!");
}
}],
cancelCallback: function() {
log("Dialog was canceled by the user by hitting the back button");
}
});
dialog.show();
}
}).appendTo(this);
},
updateView: function() {
},
});
I am now trying to set the text entered in the password text entry button into a variable 'password' . The dialog box in the text entry button actually shows the value of the password variable however, the dialog box in the submit button shows the value of the password variable as 'undefined'. Can anyone tells me why did it happen?