2 Replies Latest reply on Jul 18, 2016 10:15 AM by FedWorker

    Value must be between 0.5 and 200 in 0.5 increments


      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!