Results 1 to 4 of 4

Thread: allowBlank: false on form fields not validating field on render.

  1. #1

    Default allowBlank: false on form fields not validating field on render.

    I have a simple form panel and I would like to indicate that one or more of the fields its required. I set the allowBlank property to false to not allow for blanks but that does not get validated when the form panel is rendered. I.E. I have to click in the text field and then click out to blur the field and then I can see that blank is invalid. What is the proper way to show the user that fields are required (cannot be blank)?

    I am using 3.2.1. Is this a bug?

    Code:
    new Ext.form.FormPanel({
      renderTo: 'test',
      title: 'My Title',
      monitorValid: true,
      items: [{
        xtype: 'textfield',
        fieldLabel: 'Field',
        allowBlank: false
      }]
    });

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791

    Default

    This is intended behaviour. Marking a field as invalid before the user has had chance to type in a value is the sort of UI design that causes perfectly sane people to put their fist through their screen. If you want to promote monitor sales in this way you could always call the validate() method after the field is rendered.

    The standard UI convention for denoting a required field is to put a star next to the field, usually in red. This can be a little fiddly in ExtJS 3 but it can be done.

  3. #3

    Default

    I can see that marking field invalid before a user has a chance to enter info can be frustrating. But I think it is even more frustrating when a user cannot submit a form because of an invalid field (ie blank). I.E. I have the formBind property on my submit button set to true. If you never enter the field that has the allowBlank property set you will never know it is invalid. This makes the users frustrated as to why they cannot hit the submit button when everything on the form looks ok. Seems like if I have monitorValid turned on for my form that the field should be validated while polling and it should turn up invalid.

    Again just my opinion. But glad to know this is by design and not something stupid I am doing. I can either call validate on render or I have found that setting the value property to a blank string ('') will cause the field to be validated on render as well.

    thanks, and again I really appreciate the help, what a great community!!!

  4. #4
    Roberto Lopez's Avatar
    Join Date
    Feb 2016
    Location
    Dallas Texas USA
    Posts
    23

    Default

    Quote Originally Posted by skirtle View Post
    Marking a field as invalid before the user has had chance to type in a value is the sort of UI design that causes perfectly sane people to put their fist through their screen. If you want to promote monitor sales in this way you could always call the validate() method after the field is rendered.
    Respectfully disagree, alot of sane people like to see the invalid fields before they have a chance to type in a value.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •