Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

Generating pdfs with invisible sections made visible through code

Avatar

Level 2

I have a survey with several question that are either visible or hidden based on the user's selection from a Yes/No radio button group.  The user can then either submit the survey by e-mail or print the survey.  If the user prints the survey before submission, all of the invisible portions that the user's input has rendered visible are included in the printed copy; however, when the pdf is generated to be attached to the e-mail submission or saved using the Save As option, the elements that were made visible by code are not included in the pdf.  The following is the code being used in the Yes radio button:

Comp4WhenImplementText.presence = "invisible";

Comp4WhenImplement.presence = "invisible";

Comp4MajorFactorText.presence = "invisible";

Comp4WhenImplement.Comp4When03 = 0;

Comp4WhenImplement.Comp4WhenNever = 0;

if (Comp4No.selectedIndex != -1 ||

  Page3.Comp1.Comp1No.selectedIndex != -1 ||

  Page4.Comp2.Comp2No.selectedIndex != -1)

{

CorrectiveAction.presence = "visible";

}

else

{

CorrectiveAction.presence = "invisible";

}

The code in the No radio button is as follows:

Comp4WhenImplementText.presence = "visible"

Comp4When.presence = "visible"

CorrectiveAction.presence = "visible"

The code in the e-mail submit button:

               form1.#subform[12].Button2::click - (JavaScript, client)

               if (CorrectiveAction.presence == "visible")

                {

                  if ((CorrectiveAction.rawValue == null) || (CorrectiveAction.rawValue == ""))

                }

               else

               {

               Button1.execEvent("click");

               }

               {

               else

               {

               Button1.execEvent("click");

               }

Button1 is invisible and layered under the visible e-mail submit button.  It actually submits the pdf by e-mail.  The visible button performs a test and displays a message to the user if the user's survey answers fail.  I have also tried "hidden" in all of the areas that are listed as "invisible".

What should be added or changed so that the invisible elements of the survey that are rendered visible by code can be seen in the pdf of the survey.  Any assistance would be greatly appreciated.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

There is a setting that indicates to save the changes amde via code to the form when saved. In Designer goto the File/Form Properties/Defaults and ensure that the Radiobutton named Automatically under the Preserve Scripting changes to form when saved is set on.

Paul

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

There is a setting that indicates to save the changes amde via code to the form when saved. In Designer goto the File/Form Properties/Defaults and ensure that the Radiobutton named Automatically under the Preserve Scripting changes to form when saved is set on.

Paul

Avatar

Level 2

Thanks, everything seems to be working now!

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----