Foren

Custom Validation

Madhukara Patel, geändert vor 7 Jahren.

Custom Validation

Junior Member Beiträge: 46 Beitrittsdatum: 23.03.15 Neueste Beiträge
Hello,

I want to add custom validation for text fields.
But i have to call default function for custom validation.

Means i am not writing any function in body .

below i written function in body instead of this i want to call default general function for validation . Like mentioned in yellow color . Please help me to out this.
{
body: function (val, fieldNode, ruleValue) {
var result = false;
if (val >=18) {
result = true;
}
return result;
},
custom: true,
errorMessage: 'Age must More than 18 years',
fieldName: '<portlet:namespace/>var2',
validatorName: 'custom_rule_age'
},];



function regxp(val, fieldNode, ruleValue){
}
Madhukara Patel, geändert vor 7 Jahren.

RE: Custom Validation

Junior Member Beiträge: 46 Beitrittsdatum: 23.03.15 Neueste Beiträge
Madhukara Patel:
Hello,

I want to add custom validation for text fields.
But i have to call default function for custom validation.

Means i am not writing any function in body .

below i written function in body instead of this i want to call default general function for validation . Like mentioned in yellow color . Please help me to out this.
{
body: function (val, fieldNode, ruleValue) {
var result = false;
if (val >=18) {
result = true;
}
return result;
},
custom: true,
errorMessage: 'Age must More than 18 years',
fieldName: '<portlet:namespace/>var2',
validatorName: 'custom_rule_age'
},];



function regxp(val, fieldNode, ruleValue){
}


I want call that function like general function
function regexp(){
}

this function i want call in custom validation
thumbnail
Nikhil Nishchal, geändert vor 7 Jahren.

RE: Custom Validation

Regular Member Beiträge: 177 Beitrittsdatum: 22.06.12 Neueste Beiträge
You can go through this:
http://www.liferaysavvy.com/2014/01/objective-perform-form-validation-in.html