Expand my Community achievements bar.

Define minimum / maximum value of decimal field

Avatar

Former Community Member

This forum has been a huge help in creating my first form in LiveCycle Designer - thanks so much for all the help already!

I have a Decimal Field ("Total") that calculates the total of all items selected from a series of drop down lists.  Additionally, I have a Decimal Field ("Deposit") that calculates what 20% of "Total" is.  I have set "Deposit" to be "Calculated - User Can Override" so that the user can specify a different amount as their deposit.  However, I would like to enable validation that would ensure the amount the user enters is equal to or greater than 20% of "Total" (I assume this would be "on change" of the field).

Is there a way to specify a minimum value that can be entered on a Decimal Field?

1 Reply

Avatar

Level 9

Hi,

It will be better if you will do the validation in the exit event of the Deposit field. So if the user enters a wrong value and exits the field it will prompt the user to enter the currect value.

so you can write the code in the exit event of the Deposit Field.

var Total = Totalfield.rawValue.

var Deposit = DepositField.rawValue.

if !(Deposit >= Total/5) // As 20%x = x/5

     {

          app.alert("Please enter a correct value" ); // Any message you want to display;

          this.rawValue = null; // Just to make the field's value null or you can set the value to default 20% = Total/5

}

Thanks,

Bibhu.