EasyUI Forum
September 14, 2025, 06:21:53 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: Dynamically change the validType of a easyui-validatebox...  (Read 14925 times)
elcidofauy
Newbie
*
Posts: 11


View Profile
« on: July 16, 2014, 11:06:40 PM »

Dear All,

I'm trying to figure out how to dynamically set the validType of a easyui-validatebox. In this particular situation I have combo-box and when various values are selected then I need to change the validType of the text box. For example lets say I select value 1 from the combo-box then the text box can have free text (no validation), however if I select value 2 from the combo the textbox needs to be a valid URL.

I have managed to write the code to the point where I have detected the combo box change but I am unable to figure out how to change the validType of the textbox.

Appreciate your help!
Logged
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« Reply #1 on: July 16, 2014, 11:23:53 PM »

var status = 0;
if (status == 1 ) {
$('#textbox').validatebox({
    validType: 'url'
});
} else {
$('#textbox').validatebox({
    validType: 'number'
});
}
Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
elcidofauy
Newbie
*
Posts: 11


View Profile
« Reply #2 on: July 16, 2014, 11:54:55 PM »

Hi Aswzen,

Awesome!! Yes indeed this works... I also note by setting validType: '' (empty string) removes any previous assigned validTypes...

Many Thanks...  Smiley
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!