1

使用 Sencha Touch 2 在 Android 应用程序中单击按钮,在模拟器上运行良好,但在 Android 设备上产生问题。当我单击模拟器中的按钮时,它会显示正确的警报消息,但是当我单击设备中的按钮时,它什么也不显示。如果情况下,它不会进入内部。我的按钮代码如下: -

{ xtype: 'button',
            text: 'Save',
         handler: function(){
         val3 = Ext.getCmp('na').getValue();
         console.log(val3);
         val = Ext.getCmp('ea').getValue();          
         console.log(val);
         val4 = val.indexOf("@");
         console.log(val4);
         val5 = val.lastIndexOf(".");
         console.log(val5);
         val2 = Ext.getCmp('pa').getValue();
         console.log(val2); 
         val1 = Ext.getCmp('ra').getValue();    
         console.log(val1); 
            var isValid = true;
            Ext.Msg.alert("Info", "123");
            var errors = new Array();
            Ext.Msg.alert("Info", "456");
           //validate the name                        
            if (val3.search(/[0-9]/) > -1) {
            Ext.Msg.alert("Info", "789");
              isValid = false;
              errors.push({field : 'name',
              reason : 'Name must not contain numbers'});
                }
             if (val3.length <= 0) {

              isValid = false;
              errors.push({field : 'name',
              reason : 'Name should not be blank'});
                }

                if (val3.search(/[@]/) > -1) {
              isValid = false;
              errors.push({field : 'name',
              reason : 'Name must not contain special characters'});
                }
             //validate e-mail                        
              if (val4<1 || val5<val4+2 || val5+2>=val.length)
             {
             isValid = false;
                errors.push({field : 'email',
                reason : 'Invalid email id'});
             }
            if (val.search("/^([a-zA-Z0-9_\.\-])+(@[a-z])+([.][a-z])+$+") > -1){
                isValid = false;
                errors.push({field : 'email',
                reason : 'Invalid Email address'});
              }
            if (val.length <= 0){
                isValid = false;
                errors.push({field : 'email',
                reason : 'Email address should not be blank'});
              }                   
            //validate Password                        
            if (val1 != val2) {
                isValid = false;
                errors.push({field : 'reenter',
                reason : 'Password do not match'});
                 } 
            if(val2 <= 0){
               isValid = false;
               errors.push({field : 'password',
               reason : 'Password should not be blank'});
                 }  
            if(val1 <= 0){
               isValid = false;
               errors.push({field : 'reenter',
               reason : 'Re-enter Password should not be blank'});
                 }  
            if(val1.length > 4){
               isValid = false;
               errors.push({field : 'reenter',
               reason : 'Re-enter Password should not be more than 4 characters'});
               }  
            if(val2.length > 4){
               isValid = false;
               errors.push({field : 'password',
               reason : 'Password should not be more than 4 characters'});
              }  
            //show error if the validation failed                        
            if (!isValid) {
               var errStr = "";
               Ext.each(errors, function(error, index){
               errStr += "[" + (index+1) + "] - " + error.reason + "\n";
               });
               Ext.Msg.alert("Error", errStr);
              } else {
                Ext.Msg.alert("Info", "Success");
               }
             }
4

0 回答 0