Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Dynamic hidden Subform not visible after saving and opening.

Avatar

Level 1

I have another mystery on my hands. I have a button that makes a hidden subform visible. Once clicked for viable the user can fill it out the boxes in the subform. Then when done the form is saved and when re-opened by the user to make correction or to print, this subform reverts to hidden, but the data is still there. Is there any way to keep this subform visible after filling out, saving and opening?

Any help or script ideas would be appreciated

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

There are a couple of options but the simplest is probably to test the presence of data when the form opens. So, for example, if one of the fields in the subform is called hatsize, in the docReady event in a parent subform do something like

          var fld1 = hatsize;   (or a path to it)


     if (fld1.rawValue != "" && fld1.rawValue != null)  {

          myForm.presence = "visible";

     }

View solution in original post

4 Replies

Avatar

Correct answer by
Former Community Member

There are a couple of options but the simplest is probably to test the presence of data when the form opens. So, for example, if one of the fields in the subform is called hatsize, in the docReady event in a parent subform do something like

          var fld1 = hatsize;   (or a path to it)


     if (fld1.rawValue != "" && fld1.rawValue != null)  {

          myForm.presence = "visible";

     }

Avatar

Level 1

I will try it and get back to this form.  Thanks for the reply

Avatar

Level 10

Also, in File>Form Properties>Defaults make sure that the option to "preserve scripting changes to form when saved" is set to Automatically.

Avatar

Level 1

fbook, thanks for your post, worked perfectly!  I going to  nominate you for a distinguished service award!

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] ----