EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: rezzonico on July 21, 2015, 03:58:21 AM



Title: Form + combotree
Post by: rezzonico on July 21, 2015, 03:58:21 AM
Hi all,

I have the following form:
http://195.144.40.170/AAA/index.html

When I hit "Submit" the message "This field is required" appears near the first field.
Now write a text in the first field and hit "Submit" again.
Near the second field doesn't appear the text "This field is required".
Why ?
The only difference is that the first field is a textbox and the second field is a combotree.

Any help is appreciated.
Regards.
Miche


Title: Re: Form + combotree
Post by: stworthy on July 21, 2015, 06:52:04 PM
Please try to set the 'editable' property to true for your combo tree component.


Title: Re: Form + combotree
Post by: rezzonico on July 22, 2015, 07:28:56 AM
Hi Stworthy,

I have modified the code as suggested and it works.
Unfortunately now I have another problem ...
Now the user can edit the field and I want to avoid this ...

In other words the user must only be able to select the value from the combotree.

Regards
Miche


Title: Re: Form + combotree
Post by: stworthy on July 22, 2015, 08:23:46 AM
A readonly validatebox can not auto display the tip message when validating. If you really want to let it display the tip message, please try to override the $.fn.combotree.defaults.events.focus function.
Code:
$.fn.combotree.defaults.events.focus = function(e){
var target = e.data.target;
var state = $.data(target, 'validatebox');
var box = $(target);
// if ($(target).attr('readonly')){return;}
state.validating = true;
state.value = undefined;
(function(){
if (state.validating){
if (state.value != box.val()){ // when box value changed, validate it
state.value = box.val();
if (state.timer){
clearTimeout(state.timer);
}
state.timer = setTimeout(function(){
$(target).validatebox('validate');
}, state.options.delay);
} else {
if (state && state.tip){
$(target).tooltip('reposition');
}
}
setTimeout(arguments.callee, 200);
}
})();
}


Title: Re: Form + combotree
Post by: rezzonico on July 23, 2015, 04:09:07 AM
Hi Stworthy,

thanks a lot for your help !

Regards.
Miche