1. #1
    Sencha User
    Join Date
    Jun 2011
    Location
    Russia
    Posts
    34
    Vote Rating
    1
    icemanovich is on a distinguished road

      0  

    Default Answered: Ext.MessageBox.prompt to password

    Answered: Ext.MessageBox.prompt to password


    Hi,

    I try to change default textField (input) in Ext.MessageBox.prompt dialog, but can't do this. This field should be launch when user click the button and try to upload file.

    Search result give me this:
    http://www.sencha.com/forum/showthre...ssword-control
    but it doesn't works.

    Does any one knows how to do that?

    Code:
    Ext.MessageBox.prompt('login', 'input password:', function(btn, text){ 
        if (btn === 'ok'){
            var form = Ext.getCmp('formPanelManager').getForm();
            if(form.isValid()){
                form.submit({
                    
                    url: 'controller/tab_manage/uploadConfig.php',
                    params: { upas: text },
                    success: function(fp, o) {
                        
                        console.info(o);
                        if ( o.result.success == "true") {
                            // success
                        } else if(o.result.success != true) {
                            // error
                        }
                    }
                });
                Ext.getCmp('panelUpdate').items.items[0].value = '';
            }
        }
    });

    Thanks.

    1. You are referencing a thread from Ext JS 2 so I wouldn't expect it to work.
    2. Ext.window.MessageBox isn't very customizable. Simply, it already creates a textfield and you can't configure that textfield.

    So it's not easy so since Ext.window.MessageBox extends Ext.window.Window and just adds components, you could just create your own Ext.window.Window

  2. #2
    Sencha User
    Join Date
    Nov 2011
    Posts
    39
    Answers
    5
    Vote Rating
    0
    Araberen is on a distinguished road

      0  

    Default


    You can't. Take a look at the prompt method:
    Code:
        prompt : function(cfg, msg, fn, scope, multiline, value){
            if (Ext.isString(cfg)) {
                cfg = {
                    prompt: true,
                    title: cfg,
                    minWidth: this.minPromptWidth,
                    msg: msg,
                    buttons: this.OKCANCEL,
                    callback: fn,
                    scope: scope,
                    multiline: multiline,
                    value: value
                };
            }
            return this.show(cfg);
        }
    Enjoy my solution:
    Code:
        var w = Ext.MessageBox.show({
          prompt: true,
          title: 'Prompt',
          msg: 'msg',
          buttons: Ext.MessageBox.OKCANCEL
        });
        w.getEl().dom.children[1].children[0].children[1].children[1].children[0].children[0].setAttribute('type', 'password');
    ^^

  3. #3
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,801
    Answers
    3467
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    1. You are referencing a thread from Ext JS 2 so I wouldn't expect it to work.
    2. Ext.window.MessageBox isn't very customizable. Simply, it already creates a textfield and you can't configure that textfield.

    So it's not easy so since Ext.window.MessageBox extends Ext.window.Window and just adds components, you could just create your own Ext.window.Window
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #4
    Sencha User
    Join Date
    Jun 2011
    Location
    Russia
    Posts
    34
    Vote Rating
    1
    icemanovich is on a distinguished road

      0  

    Default


    As mitchellsimoens said,

    So it's not easy so since Ext.window.MessageBox extends Ext.window.Window and just adds components, you could just create your own Ext.window.Window
    I created my own Window with components and submit upload form by button click.

    Code:
    xtype: 'button',
    id: 'confirmButton',
    width: 75,
    text: 'Ok',
    margins: '0 10 0 0',
    formBind: true,
    handler: function(){
        var form  = this.up('form').getForm();
        var ftext = form.getValues().upass;
        var manageForm = Ext.getCmp('formPanelManager').getForm();
        if(manageForm.isValid()){
            
            manageForm.submit({
                url: 'controller/tab_manage/uploadConfig.php',
                params: { upass: ftext },
                success: function(fp, o) {
                    console.info(o);
                    if ( o.result.success == "true") {
                        // MSG SUCCESS
                    } else if(o.result.success != true) {
                        // MSG ERROR
                    }                                                       
                },
                failure: function(form, action){
                    console.info("ERROR ", action); //...
                    Ext.MessageBox.show({title: 'Error.', msg: 'Error# <br />' + action.result.msg, buttons: Ext.MessageBox.OK, icon: Ext.MessageBox.ERROR});
                }  
            });
            Ext.getCmp('panelUpdate').items.items[0].value = '';
            Ext.getCmp('confirmWindow').close(); 
        }
    }
    P.S. Araberen, first of all, I thought the save way to get input component by call child[0] ...child[1] ...child... But this is dirty hack

    Thanks for yours advices!

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi