Validation Formula

Explorer ,
Feb 25, 2021 Feb 25, 2021

Copy link to clipboard

Copied

Hello,

 

I'm trying to write a validation formula and having trouble.  Hoping someone might have some ideas on how to make it work.  I wrote a script and I would like the result to show unless if falls between -10 and 10.  Here is what I came up with but it doesn't work.

 

var a = this.getField("B22").value;
if (event.value -10 <= 10)event.value=(event.value = 0);
else event.value;

 

Thank you in advance for any ideas on this.

TOPICS
JavaScript

Views

52

Likes

Translate

Translate

Report

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

correct answers 1 Correct Answer

Adobe Community Professional , Feb 25, 2021 Feb 25, 2021
Hi, you don't need var a...  and else... part of the code.if(event.value <= 10 && event.value >=-10) event.value = 0;

Likes

Translate

Translate
Explorer ,
Feb 25, 2021 Feb 25, 2021

Copy link to clipboard

Copied

Well, i kept playing with javascript validation and this one below i came up with is working!  I thought i'd share it because it works.  I'm a novice but who knows maybe someone might find it useful.

 

var a = this.getField("B22").value;
if ((event.value <= 10) && (event.value >= -10) ) event.value = 0;
else event.value;

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Feb 25, 2021 Feb 25, 2021

Copy link to clipboard

Copied

Hi, you don't need var a...  and else... part of the code.

if(event.value <= 10 && event.value >=-10)
event.value = 0;

 

Likes

Translate

Translate

Report

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 ,
Feb 25, 2021 Feb 25, 2021

Copy link to clipboard

Copied

I really appreciated that!  I'm trying to learn and little tips mean alot.  YOU ARE AWESOME to take the time to comment.

 

Thank you.

Steve

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Feb 26, 2021 Feb 26, 2021

Copy link to clipboard

Copied

LATEST

No problem, if you need help let me know 🙂

Likes

Translate

Translate

Report

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