EasyUI Forum

General Category => General Discussion => Topic started by: featheral on October 07, 2019, 08:47:53 PM



Title: form: clear vs reset
Post by: featheral on October 07, 2019, 08:47:53 PM
Hi.
Would appreciate someone clarifying the difference between the two methods.
The docs have only this:
Quote
clear   none   Clear the form data.
reset   none   Reset the form data. Available since version 1.3.2.

Thanks!


Title: Re: form: clear vs reset
Post by: jarry on October 08, 2019, 08:33:52 PM
The 'clear' method just clears the field values. The 'reset' method will reset the field values to their original status.


Title: Re: form: clear vs reset
Post by: featheral on October 08, 2019, 11:53:17 PM
Thanks. I find though that this explanation doesn't add much on-top of the quoted docs... Perhaps if someone can explain the methods without circular references (like 'the reset() method resets and the clear() method clears').
Is it that 'reset' will revert the field to a default value, whereas 'clear' will set it to an empty string? What does a field's 'status' include?


Title: Re: form: clear vs reset
Post by: jarry on October 09, 2019, 02:47:24 AM
Please look at this code, the textbox has a 'value1' set as a default value. If you modify its value at runtime, then call 'reset' method, the value will be reset to 'value1'. But if you call 'clear' method, the value will be empty.
Code:
<input class="easyui-textbox" value="value1" name="address" style="width:100%">