EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: jaimi on October 24, 2014, 02:55:16 AM



Title: Text box validate box
Post by: jaimi on October 24, 2014, 02:55:16 AM
Hello,

I have difficulties managing the properties of the textBox/validateBox within my formular.
For example, how to verify that the length ot a value must be exactly 64?
Can I add this to :
$('#HOM_NAME').validatebox({
  required: true,
  validType: 'length[0,64]',
  missingMessage: 'Geben Sie den Pferdenamen ein.',
  invalidMessage: 'Der Pferdename ist notwendig.',
  prompt: 'Pferdename...'
 });

Another problem ist that it doesn't show the prompt.

May anyone can give me a example/tutorial?

Thanks.
Jaimi


Title: Re: Text box validate box
Post by: jarry on October 24, 2014, 07:41:28 AM
You can extend a new rule to validate if a string length is exactly the given length value.
Code:
$.extend($.fn.validatebox.defaults.rules, {
len: {
validator: function(value, param){
return value.length == param[0];
},
message: 'The message length must be {0}'
}
})


Title: Re: Text box validate box
Post by: jaimi on October 24, 2014, 11:04:28 PM
Hi , I don't understand how to use this.
The message should apear within the tooltip for a specific textbox.

And what about the prompt?

Thanks.
Jaimi


Title: Re: Text box validate box
Post by: jarry on October 25, 2014, 02:27:07 AM
Please read this documentation to learn how to extend a validation type and apply it to a component.
http://www.jeasyui.com/documentation/validatebox.php