Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Custom Validation message for mobile number field

Avatar

Level 6

Hi Team,

 

I have create one basic form it contains some of the field and one of field is mobile number now i need to validate mobile number field for that  i went to rules editor for mobile number field and written code like below

(this.value && this.value.match(new RegExp(/^[0-9]+$/) != null) ? false : true

 

It returns true or false value i need to send some custom validation message how i can do that

any suggestion is appreciated  

 

 

4 Replies

Avatar

Employee

You can use the field properties to set the patterns for the field using the regex and specify the error message there in the property of the field

no need to go the rule editor route

Avatar

Level 6

@workflowuser 

 

Thanks for your input.

 

 

But if i want to send custom error message rules edit how i can send. 

if you done any example sending error message from rules editor plz share with  me

Avatar

Level 10

@manikanthar1295 you need to set custom error message using validateExpMessage 

 sample:

             if(objStartTime.value < objEndTime.value){
				//All validations are successfull 
                testResult = true;
            }else{
                //Start Time is after End Time
                objStartTime.validateExpMessage = "Invalid Time periode. Please enter a earlier time for the 'start time'.";
                testResult = false;
            }