EasyUI Forum

General Category => General Discussion => Topic started by: mauroxavier on September 30, 2014, 08:19:59 AM



Title: How can I return all invalid fields of Form?
Post by: mauroxavier on September 30, 2014, 08:19:59 AM
How can I return all invalid fields of Form? 

I have a form and want a list of all fields that have not been validated by the function $('#form').form('validate')


Title: Re: How can I return all invalid fields of Form?
Post by: stworthy on September 30, 2014, 05:03:02 PM
The invalid input box has 'validatebox-invalid' class. Search all these input boxes and you will be able to get all the invalid form fields.
Code:
var fields = $('#ff').find('input[textboxName]').filter(function(){
return $(this).textbox('textbox').hasClass('validatebox-invalid');
});
fields.each(function(){
if ($(this).hasClass('datebox-f')){
// is datebox
} else if ($(this).hasClass('textbox-f')){
// is textbox
}
})