Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Need Java Help

Avatar

Level 4

Okay I am sure I am missing something small but I can't figure it out. 

I am putting this on the Print Button Click event.  If the checkboxes aren't checked it should provide an error message.  If the checkboxes are clicked then the doc should print.  What am I missing. 

Thanks!

Jodi

if(CheckBoxD.rawValue == "0")
   {messagetext=messagetext+"\tCheck Question D\n";
   errorcount = errorcount + 1;}
   
if (CheckBoxE1.rawValue == "0")
{messagetext=messagetext+"\tCheck Question E1\n";
errorcount = errorcount + 1;}

if (CheckBoxE2.rawValue == "0")
{messagetext=messagetext+"\tCheck Question E2\n";
errorcount = errorcount + 1;}

if (CheckBoxE3.rawValue == "0")
{messagetext=messagetext+"\tCheck Question E3\n";
errorcount = errorcount + 1;}

if (CheckBoxF1.rawValue == "0")
{messagetext=messagetext+"\tCheck Question F1\n";
errorcount = errorcount + 1;}

if (CheckBoxF2.rawValue == "0")
{messagetext=messagetext+"\tCheck Question F2\n";
errorcount = errorcount + 1;}

if (CheckBoxF3.rawValue == "0")
{messagetext=messagetext+"\tCheck Question F3\n";
errorcount = errorcount + 1;}

if (errorcount == 0)
{xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);}

else {xfa.host.messageBox("Missing Required Field(s):\n"+ messagetext);}

1 Reply

Avatar

Level 7

Did you declare errorcount somewhere before what you posted?

There should be a line with var errorcount = 0; somewhere before you use it.