Hybrid View

  1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    4
    Vote Rating
    0
    uuilee is on a distinguished road

      0  

    Default Custom validator comparing two fields

    Custom validator comparing two fields


    I have two DateFields, startDate and endDate.
    I want to write a validator that checks that startDate should be smaller than endDate and vice versa.

    The Validator interface however only accepts one field and one value.
    What's the best way to implement the this check?

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      1  

    Default


    One option would be to make the validator implementation's constructor accept as an argument the second field to compare against. Then, make a new instance of the validator for each field, pointing at the corresponding field that it needs to work with to behave correctly.

    Another option would be to just make an anonymous subclass, and as long as the other field is made final (or an instance variable), refer to it within the implementation.

  3. #3
    Sencha User
    Join Date
    Nov 2012
    Posts
    4
    Vote Rating
    0
    uuilee is on a distinguished road

      0  

    Default


    Thanks, solved by putting the required fields into the constructor.

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