Copy link to clipboard
Copied
Hi, I want to make javascript arbitrary mask with custom alert message.
This is what i tried as "Custom format script"
var v = event.value;
x = util.printx("999", v);
if(event.value != x){
app.alert("test");}
It only gives me alert if there is more then 3 digits if it's less digits then nothing.
I want to input 3 digits no more and no less and if it's not 3 digits exactly I want alert with custom msg.
Copy link to clipboard
Copied
Use this:
if (event.value && event.value.length!=3) app.alert("test");
Copy link to clipboard
Copied
Use this:
if (event.value && event.value.length!=3) app.alert("test");
Copy link to clipboard
Copied
Thank you so much.
Copy link to clipboard
Copied
I have another issue now, i have another alert in calculation script, while i was using arbitrary mask i only got alert for mask now when value was wrong now I'm getting both alert pop up.
Copy link to clipboard
Copied
What are conditions for second alert?
Try using 'else if' for second alert.
Copy link to clipboard
Copied
A calculation script will execute each time any field in the file is edited. If you only want it to show the alert when that specific field is edited use the code as the validation script, instead.
Copy link to clipboard
Copied
I tried adding to validate but problem was both scripts was in same field and was getting two alerts, but with arbitrary mask for some reason that wasn't the case, so I put both alerts in same calculation and used else if as Nesa suggested, it's working for now.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more