1. #1
    Ext User
    Join Date
    Jul 2008
    Posts
    4
    Vote Rating
    0
    md10024 is on a distinguished road

      0  

    Default MultiField validation/allowBlank

    MultiField validation/allowBlank


    Hi,

    In GXT 1.0.1 I'm using a MultiField to put first & last names on the same row and not allowing them to be blank. (see code example below). However formPanel.isValid() returns true even when firstNameText & lastNameText are blank. I suspect this is a bug...

    MultiField nameField = new MultiField();
    nameField.setFieldLabel("Full Name");
    TextField firstNameText = new TextField();
    nameField.add(firstNameText);
    firstNameText.setEmptyText("First");
    firstNameText.setAllowBlank(false);
    formPanel.add(nameField);

    TextField lastNameText = new TextField();
    lastNameText.setFieldLabel("");
    lastNameText.setEmptyText("Last");
    lastNameText.setAllowBlank(false);
    nameField.add(lastNameText);

  2. #2
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    3
    gslender is on a distinguished road

      0  

    Default


    there is a bug - a few in fact... (I've logged the bug too)

    1) FormPanel.isValid() calls Field.isValid which calls validateValue(getRawValue()) - the problem is the getRawValue which when using empty text, results in text being in the field and so its evaluated as not being empty - which is clearly wrong.

    Workaround is to not set an empty field - which works, but you get an incorrect msg.

    2) Multifield displays the wrong invalid msg because of this code...
    Code:
    // validate fields
        for (Field f : fields) {
          if (!f.validateValue(value)) {
            markInvalid("sdfdsffd"); /// <<<<<<<<<<<<<<< what the ????
            return false;
          }
        }

  3. #3
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    I have changed the logic for validation with MultiField. I have also added a spacing option which is needed to display the error icon on the fields in a horizontal orientation. Changes are in SVN.

    Code:
      public void onModuleLoad() {
        MultiField nameField = new MultiField();
        nameField.setOrientation(Orientation.VERTICAL);
        nameField.setFieldLabel("Full Name");
        nameField.setSpacing(5);
    
        TextField firstNameText = new TextField();
        nameField.add(firstNameText);
        firstNameText.setEmptyText("First");
        firstNameText.setAllowBlank(false);
    
        TextField lastNameText = new TextField();
        lastNameText.setFieldLabel("");
        lastNameText.setEmptyText("Last");
        lastNameText.setAllowBlank(false);
        nameField.add(lastNameText);
    
        FormPanel formPanel = new FormPanel();
        formPanel.add(nameField);
    
        RootPanel.get().add(formPanel);
      }

Thread Participants: 2

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