EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: dj_niv on November 24, 2014, 12:14:50 AM



Title: disable elemnts not working on validation
Post by: dj_niv on November 24, 2014, 12:14:50 AM
Hello,

In form some elements are disable before submit although validation is not disabled on that element
I want to do disabled and enabled all form elements through jQuery or Javascript and stop validation for disabled dataslots.

Here I attached demo code for same.



Title: Re: disable elemnts not working on validation
Post by: stworthy on November 24, 2014, 07:34:39 AM
You can disable the from validation before disabling or enabling some specified fields. After that enable the form validation again.
Code:
$('input:radio[name=demonstration]').change(function() {
//alert(this.value); 
$('#ff').form('disableValidation');
if(this.value=='No')
{
$('#uName1').prop('disabled', true);
$('#fSub').prop('disabled', true);
}
if(this.value=='yes')
{
$('#uName1').prop('disabled', false);
$('#fSub').prop('disabled', false);
}
$('#ff').form('enableValidation');
});