EasyUI Forum
April 24, 2024, 02:53:03 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: prevent changes in a datebox field  (Read 3403 times)
rezzonico
Full Member
***
Posts: 182


View Profile
« on: May 10, 2021, 06:54:55 AM »

Hi,

I need to prevent changes in a datebox field depending on the selected option in a confirmation message window.

In the following link select a new date and then select "Ok" on the confirmation message window.
Then select another date and then select "Cancel" on the confirmation message window.

http://195.144.40.170/jeasyui/AAA5/

As you can see the datebox is empty despite in my code there is the following line:
$('#dd').datebox('initValue', oldValue);

Any solution with onChange, onSelect, onBeforeSelect, ... is appreciated.

Regards
Miche
« Last Edit: May 10, 2021, 06:59:48 AM by rezzonico » Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: May 10, 2021, 07:52:16 PM »

Please override the 'initValue' method of the datebox.
Code:
$.extend($.fn.datebox.methods, {
initValue: function(jq, value){
return jq.each(function(){
var opts = $(this).datebox('options');
if (value){
var date = opts.parser.call(this, value);
value = opts.formatter.call(this, date);
$(this).datebox('calendar').calendar('moveTo', date);
}
$(this).combo('initValue', value).combo('setText', value);
});
}
})

Or download a newer version of EasyUI from the site.
Logged
rezzonico
Full Member
***
Posts: 182


View Profile
« Reply #2 on: May 18, 2021, 07:15:45 AM »

Thanks !

Regards
Miche
Logged
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!