使用煎茶触摸2上运行模拟器罚款,但不工作的Android设备在Android应用按钮点击(Butto

2019-09-19 18:59发布

在Android应用按钮,点击使用煎茶触摸2上运行模拟器罚款,但创建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");
               }
             }
文章来源: Button click in Android app using Sencha Touch 2 running fine on emulator but not working on Android Device