Copy link to clipboard
Copied
Hello Community!
I hope someone can please help me with this problem. I have searched for an answer to this all afternoon.
I need to create a text field that requires the user to begin their entry with digits and then any combination of letters and numbers. The number of characters in the field will vary but it must begin with 4 or 5 digits. These are some examples of how the entries would look:
I've seen a lot about the custom validation script in the field properties and regex, but I can't figure it out.
Please help! I don't know where to begin.
Copy link to clipboard
Copied
You can use this code as the field's custom Validation script (I assume there needs to be a period after the digits. If not, then you need to clarify whether it's four or five digits that the user must enter):
if (event.value) {
if (/^\d{4,5}\./.test(event.value)==false) {
app.alert("Invalid value.");
event.rc = false;
}
}
Copy link to clipboard
Copied
You can use this code as the field's custom Validation script (I assume there needs to be a period after the digits. If not, then you need to clarify whether it's four or five digits that the user must enter):
if (event.value) {
if (/^\d{4,5}\./.test(event.value)==false) {
app.alert("Invalid value.");
event.rc = false;
}
}
Copy link to clipboard
Copied
Thank you so much! Yes, the periods do need to be included so It works perfectly!
Thank you
Find more inspiration, events, and resources on the new Adobe Community
Explore Now