Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Adobe live cycle validating a prepopulated caculation field

Avatar

Level 1

Hi guys help me here plz. I have a form that has 7 numeric fields. There is another field (Total) that will have the sum of those 7 fields. I have a script for adding all the fields and populate the sum in the total field. Now what I wana do is to validate on print button that the total must not be less than 1000. If the total is less then 100 stop the print and show an alert. I have tried a bunch of ways but nuthing seems to be working. I am using JS for the addtion. Please help!!

2 Replies

Avatar

Level 9

Hi,

In the click event of the print button try the following script.

if (Total.rawValue < 1000)

     {

          app.alert("Please try again");

     }

else

     {

          xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);

     }

Thanks,

Bibhu.

Avatar

Former Community Member

hi,

Bibhu's code will work for you. If you also want to avoid the user to print it using other options like through menu -> print, then use this code in the form:pre-print event:

if (Total.rawValue < 1000)

     {

          app.alert("Please try again");

         xfa.event.cancelAction = true;

     }

else

     {

          xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);

     }

Regards,

Chaitanya