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

Value must be between 0.5 and 200 in 0.5 increments

New Here ,
Jul 18, 2016 Jul 18, 2016

I've been trying to figure out how to set a decimal field (in Adobe Experience Manager Forms Designer) so that the value must be between 0.5 and 200 in 0.5 increments.

This JavaScript in the validation field works to restrict the value between 0.5 and 200:

<= this.rawValue && this.rawValue <= 200.0;

but I haven't been able to figure out how to get the 0.5 increments part to work. I did read about the modulus/remainder function but I just can't figure out how to implement it. I'd like to have an error message appear if the value doesn't end in .0 or .5.)

I don't even know if that part of the code should be under "validate" or "calculate". I tried putting this under "calculate" based on various sample code snippets I've found online but it's not right:

nPositions = this.getField("Cell1").value;

remainder = nPositions % 0.5;

(remainder != 0) app.alert("Amount must be between 0.5 and 200 in 0.5 increments.");

Any assistance would be greatly appreciated - this is driving me crazy!

TOPICS
Acrobat SDK and JavaScript
500
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
LEGEND ,
Jul 18, 2016 Jul 18, 2016

You must realize that the displayed value is not the same as the actual value of the field used by JavaScript. I would add the code tot he calculation action.

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
New Here ,
Jul 18, 2016 Jul 18, 2016
LATEST

Yes, that's what I meant, sorry - it's in the calculation action. Does it look OK to you if that is the case?

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