Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
0

Custom alert msg

Explorer ,
Jan 04, 2021 Jan 04, 2021

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.

TOPICS
JavaScript
1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Jan 04, 2021 Jan 04, 2021

Use this:

 

if (event.value && event.value.length!=3) app.alert("test");

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 04, 2021 Jan 04, 2021

Use this:

 

if (event.value && event.value.length!=3) app.alert("test");

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 04, 2021 Jan 04, 2021

Thank you so much.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 04, 2021 Jan 04, 2021

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 04, 2021 Jan 04, 2021

What are conditions for second alert?

Try using 'else if' for second alert.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 04, 2021 Jan 04, 2021

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 04, 2021 Jan 04, 2021
LATEST

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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines