1. #1
    Sencha User
    Join Date
    Dec 2009
    Posts
    57
    Vote Rating
    0
    andreiastra is on a distinguished road

      0  

    Default How to display Date and Number Fields with NULL values as invalid?

    How to display Date and Number Fields with NULL values as invalid?


    Hi,

    I have TextFields that should not be empty. I use

    field.setAllowBlank(false);

    to achieve that.

    When the fields are initialized they do not have any value assigned to them; their values are Nulls. But, these fields are not displayed as invalid (with the red border).

    Invalid Field.JPG

    I do need to show them as invalid.

    I do not have that problem with TextField<String>, because I can always call

    stringField.setValue("");

    Now, the field is not null but blank and is properly invalidated. Unfortunately, there are no blank Date or Number values.

    Is there any trick/ workaround to display DateField and Number field with Null values as invalid?

    Thank you,

    Andrei
    Last edited by andreiastra; 19 Apr 2010 at 4:15 AM. Reason: inserted image

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,754
    Vote Rating
    113
    sven is just really nice sven is just really nice sven is just really nice sven is just really nice sven is just really nice

      0  

    Default


    Is there any trick/ workaround to display DateField and Number field with Null values as invalid?
    Set allowblank to false. Add a render event listener to the field and call setValue(null);

  3. #3
    Sencha User
    Join Date
    Dec 2009
    Posts
    57
    Vote Rating
    0
    andreiastra is on a distinguished road

      0  

    Default


    Thank you, Sven! It worked.

Tags for this Thread