1. #1
    Ext User dante's Avatar
    Join Date
    Aug 2007
    Posts
    69
    Vote Rating
    0
    dante is on a distinguished road

      0  

    Question BasicForm.reset() does not clear fields?

    According to my observings, the reset() method being defined within the BasicForm class does not clear any field contents, although that's exactly what I would expect such a method to actually do.

    The only way I found to clear an entire form is to use the setValues() method while supplying empty values for all fields. This is, apparently, pretty awkward.

    So did I miss anything? How to clear all fields in a form at once?

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,555
    Vote Rating
    61
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default

    It resets to the original values. That's what reset should do.

  3. #3
    Ext User dante's Avatar
    Join Date
    Aug 2007
    Posts
    69
    Vote Rating
    0
    dante is on a distinguished road

      0  

    Default

    Thanks animal, that's an explanation. However, wouldn't you agree that a method like clearFields() would be useful for people looking for a functionality like the original HTML form reset button behaviour?

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,555
    Vote Rating
    61
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default

    Yes, clearFields would be a good function to add to BasicForm. I have added it myself in a project I did recently.

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,555
    Vote Rating
    61
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default

    But, you have a misunderstanding. An HTML reset button resets a form's values to the original value settings, it does not clear them!

  6. #6
    Ext User dante's Avatar
    Join Date
    Aug 2007
    Posts
    69
    Vote Rating
    0
    dante is on a distinguished road

      0  

    Default

    Dear me.. you won!

  7. #7
    Ext JS Premium Member
    Join Date
    Dec 2007
    Posts
    61
    Vote Rating
    0
    Shyru is on a distinguished road

      0  

    Lightbulb

    I have an easy solution for your problem which adds a clear method to both FormPanel and BasicForm.

    Read more about it here: how to clear ext forms

    I hope that is useful for you!

Thread Participants: 2