Expand my Community achievements bar.

Issues with form validation and reset

Avatar

Level 2

I have a form where unchecked checkboxes are hidden upon printing. There is form validation that cancels printing if the validation fails.

This works EXCEPT when validation fails the form will not reset -

IF VALIDATION FAILS,  the hidden checkbox and adjacent text fields (in the subform) won't become visible again when the reset button is clicked and the form will not reset. Nothing happens when you click the reset button.

IF VALIDATION FAILS and you go back and try to fill in the missing required field and click print again, nothing happens.

IF VALIDATION SUCCEEDS everything works great and the form is reset completely.

How can I show the form again in it's entirety and blank OR reload the blank form if

10-1-2012 9-59-44 AM.jpg

There are 2 pages. Both have a Print and a reset button. The 1st page is a fax cover sheet. The 2nd page is a form with the checkboxes.

----page 1----

--THIS IS THE CODE TO HIDE THE UNCHECKED CHECKBOXES WHEN THE PRINT BUTTON IS CLICKED--

form1.P2.sfFull.sfchkbx.sfchkbx.sfck1.CheckBox1::prePrint - (JavaScript, client)

if (this.rawValue == 0)

{

     CheckBox1.presence = "visible";

     CheckBox1.presence = "hidden";

}

else

{

     CheckBox1.presence = "hidden";

     CheckBox1.presence = "visible";

}

// to hide adjacent text field

{

if (CheckBox1.rawValue == true)

   

    sfck1.presence = "visible";

    else

   

    sfck1.presence = "hidden";

}

   

   

form1.P2.sfFull.sfchkbx.sfchkbx.sfck2.CheckBox2::prePrint - (JavaScript, client)

if (this.rawValue == 0)

{

     CheckBox2.presence = "visible";

     CheckBox2.presence = "hidden";

}

else

{

     CheckBox2.presence = "hidden";

     CheckBox2.presence = "visible";

}

// to hide adjacent text field

{

if (CheckBox2.rawValue == true)

   

    sfck2.presence = "visible";

    else

   

    sfck2.presence = "hidden";

}

form1.P2.sfFull.sfchkbx.sfchkbx.sfck3.CheckBox3::prePrint - (JavaScript, client)

if (this.rawValue == 0)

{

     CheckBox3.presence = "visible";

     CheckBox3.presence = "hidden";

}

else

{

     CheckBox3.presence = "hidden";

     CheckBox3.presence = "visible";

}

// to hide adjacent text field

{

if (CheckBox3.rawValue == true)

   

    sfck3.presence = "visible";

    else

   

    sfck3.presence = "hidden";

}

--THIS IS THE CODE TO VALIDATE AND THEN CANCEL PRINTING IF VALIDATION FAILS--

form1.P2.sfFull.sfFooter.PrintButton2::click - (JavaScript, client)

// if validation fails, then cancelAction will prevent printing

if (form1.execValidate() == false)

{

xfa.event.cancelAction = true; // cancel printing

}

else

{

xfa.event.cancelAction = false; // proceed with printing

}

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

--THIS IS THE CODE TO RESET THE FIELDS AND TO SHOW THE HIDDEN CHECKBOXES WHEN THE RESET BUTTON IS CLICKED--

form1.P2.sfFull.sfFooter.ResetButton2::mouseExit - (JavaScript, client)

// reset the selected section

switch (this.rawValue)

{

    case "none":

    break;

   

    case "ResetButton2":

    var f1 = P1.somExpression + ", ";

    var f2 = f1 + P2.somExpression;

    xfa.host.resetData(f2);

    break;

}

form1.P2.sfFull.sfFooter.ResetButton2::click - (JavaScript, client)

xfa.host.resetData();

// CB1 to UNHIDE chkbx after reset if not selected

if(sfchkbx.sfchkbx.sfck1.CheckBox1.presence == "hidden")

{

    sfchkbx.sfchkbx.sfck1.CheckBox1.presence = "visible";

}

// CB1 to UNHIDE adjacent text field

{

if(sfchkbx.sfchkbx.sfck1.presence == "hidden")

   

    sfchkbx.sfchkbx.sfck1.presence = "visible";

}

// CB2 to UNHIDE chkbx after reset if not selected

if(sfchkbx.sfchkbx.sfck2.CheckBox2.presence == "hidden")

{

    sfchkbx.sfchkbx.sfck2.CheckBox2.presence = "visible";

}

// CB2 to UNHIDE adjacent text field

{

if(sfchkbx.sfchkbx.sfck2.presence == "hidden")

   

    sfchkbx.sfchkbx.sfck2.presence = "visible";

}

// CB3 to UNHIDE chkbx after reset if not selected

if(sfchkbx.sfchkbx.sfck3.CheckBox3.presence == "hidden")

{

    sfchkbx.sfchkbx.sfck3.CheckBox3.presence = "visible";

}

// CB3 to UNHIDE adjacent text field

{

if(sfchkbx.sfchkbx.sfck3.presence == "hidden")

   

    sfchkbx.sfchkbx.sfck3.presence = "visible";

}

form1.P2.sfFull.sfFooter.ResetButton2::mouseExit - (JavaScript, client)

// reset the selected section

switch (this.rawValue)

{

    case "none":

    break;

   

    case "ResetButton2":

    var f1 = P1.somExpression + ", ";

    var f2 = f1 + P2.somExpression;

    xfa.host.resetData(f2);

    break;

}

form1.P2.sfFull.sfFooter.ResetButton2::click - (JavaScript, client)

xfa.host.resetData();

// CB1 to UNHIDE chkbx after reset if not selected

if(sfchkbx.sfchkbx.sfck1.CheckBox1.presence == "hidden")

{

    sfchkbx.sfchkbx.sfck1.CheckBox1.presence = "visible";

}

// CB1 to UNHIDE adjacent text field

{

if(sfchkbx.sfchkbx.sfck1.presence == "hidden")

   

    sfchkbx.sfchkbx.sfck1.presence = "visible";

}

// CB2 to UNHIDE chkbx after reset if not selected

if(sfchkbx.sfchkbx.sfck2.CheckBox2.presence == "hidden")

{

    sfchkbx.sfchkbx.sfck2.CheckBox2.presence = "visible";

}

// CB2 to UNHIDE adjacent text field

{

if(sfchkbx.sfchkbx.sfck2.presence == "hidden")

   

    sfchkbx.sfchkbx.sfck2.presence = "visible";

}

// CB3 to UNHIDE chkbx after reset if not selected

if(sfchkbx.sfchkbx.sfck3.CheckBox3.presence == "hidden")

{

    sfchkbx.sfchkbx.sfck3.CheckBox3.presence = "visible";

}

// CB3 to UNHIDE adjacent text field

{

if(sfchkbx.sfchkbx.sfck3.presence == "hidden")

   

    sfchkbx.sfchkbx.sfck3.presence = "visible";

}

3 Replies

Avatar

Level 7

This may be to do with the bug with cancelAction. Are you using Reader 10.0?

See this thread: http://forums.adobe.com/message/3852614#3852614#3852614

Avatar

Level 2

Companywide, our users are on Reader 9.5. If the bug is the issue, then I will need to change the script because our IT Dept won't implement the change until they are good and ready. If it's not the order in which the script is firing, then any suggestions other than an update?

Avatar

Level 7

No the bug is only with Reader 10.0 so if you are using an older version it may be something else. Just keep in mind though if anyone uses your form with 10.0 it will still occur - basically the bug causes cancelAction to cancel everything not just code it is assigned to.