1. #1
    Sencha Premium Member
    Join Date
    Nov 2012
    Location
    Los Angeles
    Posts
    23
    Vote Rating
    0
    austinkottke is on a distinguished road

      0  

    Default Unanswered: Get validation error messages

    Unanswered: Get validation error messages


    How do I get error messages from Validators.

    Ive used to the field interface to pull the validators using getValidators();

    But have no idea how to return the messages from the field in error.

    Example:

    Code:
    EditorDelegate<Field> d = new EditorDelegate<Field>() {
                @Override
                public String getPath() {
                    return null;  //To change body of implemented methods use File | Settings | File Templates.
                }
    
                @Override
                public void recordError(String s, Object o, Object o2) {
                    GWT.log("Record error: " + s);
                }
    
                @Override
                public void setDirty(boolean b) {
    
                }
    
                @Override
                public HandlerRegistration subscribe() {
                    return null;  //To change body of implemented methods use File | Settings | File Templates.
                }
            };
    
                f.setDelegate(d);

  2. #2
    Sencha User
    Join Date
    Jul 2012
    Location
    Italy
    Posts
    9
    Vote Rating
    0
    secretkeeper81 is on a distinguished road

      0  

    Default


    I have the same problem...has anyone found a way to do it?

  3. #3
    Sencha User
    Join Date
    Nov 2013
    Location
    Bangalore, India
    Posts
    98
    Answers
    15
    Vote Rating
    7
    vardhan22 is on a distinguished road

      0  

    Default


    I used custom validators to get the error messages.

    Code:
    
    		TextField field = new TextField();
    		field.addValidator(defaultValidators);
    	/*field.addValidator(new RegExValidator("^[a-zA-Z0-9]*", "Only alphanumericallowed"));*/
    	
    
    
      private Validator<String> defaultValidators = new AbstractValidator<String>() {
    
    
    			@Override
    			public List<EditorError> validate(Editor<String> editor, String value) {
    				List<EditorError> errors  = null;
    				if(value==null)
    					return null;
    	            if (!(value.matches("^[a-zA-Z0-9]*"))) {
    	                errors= createError(editor, "Only alphanumeric allowed", value);
    	                System.out.println(errors.get(0).getMessage());
    	            }
    	            return errors;
    			}
    		};
    You can also try extending the inbuilt validators, and getting the messages by doing the similar changes in validate method.

Thread Participants: 2

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