1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    2
    Vote Rating
    0
    Jambo is on a distinguished road

      0  

    Default Answered: Text Field set valid on function. Need to overwrite Ext invalid state

    Answered: Text Field set valid on function. Need to overwrite Ext invalid state


    Dear all,

    First time posting, but have looked at previous examples and googled a lot so please be kind!

    I am trying to reset the contents of a form inside which are some textfields which by default need to have allowBlank: false set on them. When the form contents are set to empty string "" the textfield obviously validates that the content of the textfield is false. I want to set the validation at this point to be overwritten to be true at this state, before continuing with normal behaviour once a user enters data into the box again.

    Basically I just need to reset the validation and content of the form back to it's default state before text is entered by the user.

    (TextField mentioned)

    {
    xtype: 'textfield',
    name: 'firstName',
    id:"firstName",
    fieldLabel: 'first name',
    width:entryPanelWidth,
    allowBlank: false // requires a non-empty value
    }

    (Section of function mentioned)

    var firstNameEntry = Ext.getCmp("firstName");
    firstNameEntry.setValue("")
    firstNameEntry.setValid() //TODO ?? I know this is incorrect EXT/JS and am trying to resolve this

  2. To clear the invalid state, execute the clearInvalid() method on the field.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,548
    Vote Rating
    873
    Answers
    3567
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    To clear the invalid state, execute the clearInvalid() method on the field.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Dec 2011
    Posts
    2
    Vote Rating
    0
    Jambo is on a distinguished road

      0  

    Default Thank you very much... perfect answer

    Thank you very much... perfect answer


    Thank you very much... quite embarrassed I couldn't find that myself in API's.

    Thanks Again
    James

Thread Participants: 1

Tags for this Thread