EasyUI Forum
September 14, 2025, 01:35:35 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Different between form('reset') and form('clear') ?  (Read 15473 times)
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« on: September 30, 2014, 06:00:49 AM »

Hello, I have a question:

What is the different between form('reset') and form('clear') ?
Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #1 on: September 30, 2014, 07:46:22 AM »

The 'reset' method resets the fields to their original values. The 'clear' method only clears the values of the fields.
Logged
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« Reply #2 on: January 12, 2015, 08:18:23 AM »

Hi. What you mean with "original values" ?

1) We get the form data from remote server.
2) Changing some form fields
3) Then we call
Code:
$('#formId').form('reset');
to reset the data to the original data before changing. But after that all form fields are emty! No values shown!

Is this a bug?
Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #3 on: January 12, 2015, 08:37:48 AM »

The original value is the initialized value when created the component.
Code:
$('#t1').textbox({
  value: 'v1'
});
The code above create a textbox with 'value' set to 'v1', its original value is also set to 'v1'. After calling 'reset' method, the textbox's value will be set to 'v1' even if the user enters other value.
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #4 on: May 04, 2015, 09:59:20 PM »

FYI - this works if the value attribute is hard-coded into the page before easyui executes:

Code:
<input id="myinput1" value="123">


But if you add the value attribute programmatically then you need to update the eui object:

Code:
<input id="myinput2">
$('#myinput2').textbox('options').originalValue = "123";
Logged

-- Licensed User --
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!