Hello there
I will leave here an example to make two or mode validations in the same field:
This example will use a seblod user email field with these native seblod settings (number 3 on forms and content types): required, availability
I need an additional validation to check if the field is filled with an valid email format.
So I will use the field Script (JS) in the end of my email field (stuff section) and write this code:
jQuery(document).ready(function ($) {
object2 =
{
"email": {
"regex": /^([A-Za-z0-9_\-\.'])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,10})$/,
"alertText": "* This is not a valid email!"
}
};
$.validationEngineLanguage.allRules = $.extend( $.validationEngineLanguage.allRules, object2 ); //add an extra validation
});
Still in the stuff section, in the field Class (CSS) I must write this class: validate[required,custom[email]]
And It is Done!
Seblod uses this plugin to do validation: https://github.com/posabsolute/jQuery-Validation-Engine (it is a good idea to take a look in this link)
If you need other validation objects you can make a seblod form with fields making all available kind of validations and take a look in the page source to have a list of all possible validations. Just look for "$.validationEngineLanguage.newLang" and you will see all of them below.
In this same form you can see the fields classes (in the page source) to find out wich classes each validation is using.
Enjoy!