• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Validation Formula

Participant ,
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

484

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

Community Expert , 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;

 

Votes

Translate

Translate
Participant ,
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;

Votes

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
Community Expert ,
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;

 

Votes

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
Participant ,
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

Votes

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

Copy link to clipboard

Copied

LATEST

No problem, if you need help let me know 🙂

Votes

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