EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: phunksta on November 17, 2015, 09:59:14 AM



Title: Set validType for all validatebox on form
Post by: phunksta on November 17, 2015, 09:59:14 AM
I'm sure this is just a jquery thing, but I want to set the option:

Code:
validType:'remote'

... dynamically using javascript, for all of the validatebox (including descendants i.e. textbox, combo etc.) on a form.

I have tried a few combinations of jquery selectors based on class, tried grepping inputs for prefixes of 'easyui-' but whatever I do I don't seem to be able to get a clean iteration over the validateboxes on a form.

I don't wish to set a default, because my app has plenty of other easyui controls that should not have this set. I also don't want to have to go into the markup because again, this comes from a dynamic source.

Can anyone help me with a selector that will let me add this option to a bunch of validatebox inputs?

Thanks for any help in advance!


Title: Re: Set validType for all validatebox on form
Post by: stworthy on November 17, 2015, 06:04:34 PM
Try this code to set the 'validType' for all the validatebox components.
Code:
$('.validatebox-text').each(function(){
$(this).validatebox('options').validType = ...;
})


Title: Re: Set validType for all validatebox on form
Post by: phunksta on November 18, 2015, 02:43:28 AM
Gah stworthy you make this look so easy!  ;)

Thanks so much again!