1. #1
    Ext User
    Join Date
    Jul 2010
    Posts
    6
    Vote Rating
    0
    littlefixit is on a distinguished road

      0  

    Question Dynamically changing TextField inputType for 'Hide my Typing' text field

    Dynamically changing TextField inputType for 'Hide my Typing' text field


    Hello,

    I am implementing a 'hide my typing' checkbox into a form where the user enters an answer to a password reset question into a textbox. I would like them to be able to click the checkbox, and then have it flip the text field (that they may have already entered text into) from 'text' to 'password' or vice-versa. I belive I've been able to change the inputType option, but I can't figure out how to get it to render at all. Any thoughts/suggestions? An excerpt from my code is below:

    Code:
          var resetForm = new Ext.form.FormPanel({
                 id: 'resetform',
                 url: 'process.php',
                 // standardSubmit: true,                                                                              
                 frame: true,
                 width: '475',
                 items: [{ 
                   title: 'Password Reset Question',
                   xtype:'fieldset',                
                autoHeight:true,                
                collapsed: false,
                html: question                                                     
              },{
                     xtype:'fieldset',                 
                     autoHeight:true,                
                     defaults: {width: 300},
                     defaultType: 'textfield',
                     collapsed: false,           
                     items :[{                          
                             id: 'forgot_password_answer',
                             fieldLabel: 'Your Answer',
                             inputType: 'password',
                             name: 'answer',
                             allowBlank:false                 
                         },{
                             inputType: 'hidden',
                             name: 'username',
                             value: resetusername
                         },{
                             inputType: 'hidden',
                             name: 'subresetquestion',                         
                             value: '1'
                         }]
                         
                 }]           
          });
    
          var fbar_qwin = new Ext.Toolbar({
              buttonAlign: 'left',
              width: '400',          
              items: [{
                  xtype: 'checkbox',
                  boxLabel: 'Hide my typing',
                  id: 'hidetypecheckbox',              
                  checked: true,
                  handler: function() {
                      // alert(this.getValue());
                      var field = Ext.get("forgot_password_answer");
                    if(field.getValue() == 1){                  
                          field.inputType: 'password'
                    }else{
                        field.inputType: 'text'
                    }                  
                    }                 
              },{
                  xtype: 'panel',
                  width: '275',              
                  border: false,
                  hidden: false
              },{
                  text:'Answer',
                  handler: function() {
                  resetForm.getForm().submit({
                         waitMsg: 'Verifying Answer...',        // Wait Message
                        success: function (f,a) {        // When saving data success                    
                            // location.href='index.php';                                                                        
                        },
                        failure: function (f,a) {        // when saving data failed
                            Ext.MessageBox.alert (a.result.errortype,a.result.text);
                        }
                    });
                  }
              }]
          });
          
          var qwin = new Ext.Window({
               layout: 'fit',
               id:'autoload-win',
               width: 475,
               height: 190,
               autoScroll:true,
               resizable: false,
               closable: false,
               draggable: false,
               // title: 'Login',
               items: [resetForm],
               buttons: fbar_qwin,
                  keys: [{
                      key: [Ext.EventObject.ENTER],
                      handler: function(){
                      resetForm.getForm().submit({
                             waitMsg:'Verifying Answer...',        // Wait Message
                            success: function (f,a) {        // When saving data success
                                  // location.href='index.php';                      
                            },
                            failure: function (f,a) {        // when saving data failed
                                Ext.MessageBox.alert (a.result.errortype,a.result.text);
                            }
                        });
                      }
                  }]       
          });
          
            qwin.show();
    In fbar_qwin, I've successfully been able to use an 'alert()' to echo out the value of the checkbox within the checkbox's handler, but I just can't get it to toggle what I want.

  2. #2
    Sencha User
    Join Date
    Nov 2008
    Location
    Berlin, Germany
    Posts
    24
    Vote Rating
    0
    feyyaz is on a distinguished road

      0  

    Default


    my suggestion would be to add two fields one textedit and one for password. initaly hide the password field by config, on the checkbox event i would switch visibility and copy the value field.

  3. #3
    Ext User
    Join Date
    Jul 2010
    Posts
    6
    Vote Rating
    0
    littlefixit is on a distinguished road

      0  

    Default


    I'll give it a try, thanks.

Similar Threads

  1. Ext.form.textField.maxLength dynamically changed with stop typing
    By seek in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 3 Nov 2010, 11:58 PM
  2. changing combo box to text field dynamically
    By tomalex0 in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 12 Aug 2009, 6:54 AM
  3. Text Field and TextArea resize when typing into it in IE7 only
    By sariq in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 12 May 2009, 7:58 PM
  4. Text Field and TextArea resize when typing into it in IE7 only
    By sariq in forum Ext GWT: Help & Discussion (1.x)
    Replies: 0
    Last Post: 12 May 2009, 3:27 AM
  5. Dynamically update inputType from 'password' to 'text'
    By grilltout in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 13 Jun 2008, 4:49 AM

Thread Participants: 1

Tags for this Thread

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