1. #1
    Ext User ScytheV's Avatar
    Join Date
    Nov 2009
    Posts
    13
    Vote Rating
    0
    ScytheV is on a distinguished road

      0  

    Question How to reset the textfield component with inputType: 'file'?

    How to reset the textfield component with inputType: 'file'?


    How to reset the textfield like this?
    {
    xtype: 'textfield',
    name: 'nameSBUserFileText',
    id: 'IDSBUserFileText',
    inputType: 'file'
    }

    I've tried Ext.getCmp("IDSBUserFileText").reset(),
    Ext.getCmp("IDSBUserFileText").el.dom.reset(), but they were no use.

    Anyone know this?

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    82
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    You can:
    1. Reset the <form> (which also affects other fields).
    or
    2. Destroy and recreate the field el (don't forget to reattach the listeners).

  3. #3
    Ext User ScytheV's Avatar
    Join Date
    Nov 2009
    Posts
    13
    Vote Rating
    0
    ScytheV is on a distinguished road

      0  

    Smile


    Quote Originally Posted by Condor View Post
    You can:
    1. Reset the <form> (which also affects other fields).
    or
    2. Destroy and recreate the field el (don't forget to reattach the listeners).
    I've tried the first way, it worked, but I don't want to reset other components in the form.
    Could you tell me how to destory and recreate the field el?

    Thank you very much!

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    82
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    It's rather tricky...

    Here's a patch that does this for an Ext.form.FileUploadField.
    (the Ext 3.0.3 and up contain this patch)

  5. #5
    Ext User ScytheV's Avatar
    Join Date
    Nov 2009
    Posts
    13
    Vote Rating
    0
    ScytheV is on a distinguished road

      0  

    Default


    Quote Originally Posted by Condor View Post
    It's rather tricky...

    Here's a patch that does this for an Ext.form.FileUploadField.
    (the Ext 3.0.3 and up contain this patch)
    Thank you very much man, I appreciate it a lot.

  6. #6
    Sencha User
    Join Date
    Jan 2010
    Location
    Bangalore
    Posts
    24
    Vote Rating
    0
    rohan.chandane is on a distinguished road

      0  

    Default


    try this

    Ext.getCmp("IDSBUserFileText").setRawValue('');

    setRawValue() sets the underlying DOM field's value directly, bypassing validation.

Thread Participants: 2