Custom Validation message for mobile number field | Community
Skip to main content
manikanthar1295
April 12, 2022

Custom Validation message for mobile number field

  • April 12, 2022
  • 2 replies
  • 1172 views

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  

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Adobe Employee
April 12, 2022

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

manikanthar1295
April 13, 2022

@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

Mayank_Gandhi
Adobe Employee
Adobe Employee
April 14, 2022

@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; }

 

manikanthar1295
April 15, 2022

@mayank_gandhi 

 

Thanks for your support i am able to send error message from rues editor