0

TextEntryButton

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?

by
3 Replies
  • Do this:

    CODE
    var password = this.getView().controls.confirmPasswordButton.getValue();

    var dialog = new KONtx.dialogs.Alert({
    title: "Dialog Title",
    message: 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 but
    ton");
    }
    });

    By the way, your code is riddled with typos and bad syntax. I had to alter it in several places just to get it to load.
    0
  • I am a beginner .. want to know how to fetch value using getValue()  from the textEntryButtons . i am  creating  a simple login form  and want to test if both userid and password is "admin" . but how do i compare the values entered in userid and password textEntry button ...... 

    thanks in advance

     
    0
  • Not fully sure what you mean. You can use control.getValue() to get the value of that control and use simple javascript comparison using == to do this(although for passwords this is unsecure)

    [code]
        if(this.controls.userId.getValue() == "admin" && this.controls.password.getValue() == "admin")
    log("user is admin")
    [/code]

    Thanks,
    Vivek

    QUOTE (ABHISHEK @ 9 Jan 2012 12:55 AM) I am a beginner .. want to know how to fetch value using getValue()  from the textEntryButtons . i am  creating  a simple login form  and want to test if both userid and password is "admin" . but how do i compare the values entered in userid and password textEntry button ...... 

    thanks in advance

     
    0

Recent Posts

in Getting Started / Beginners - Yahoo! TV Widgets