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

How to hide object based on checkbox with FormCalc

Avatar

Former Community Member

Hello All - I am very new to FormCalc and am having difficulty finding answers within the help menu of Adobe Pro.  The form I am creating is long and based on option requirements.  Therefore, if an option is not required (checkbox) the subsequent data fields will not show up for the user.

1st: Can I do this?

2nd: Is this the correct script:

if(Temp.rawValue ==True)

then(LowTempLOFF.Presence = = Visible)

else

LowTempLOFF.Presence="Hidden";

endif

in the example above my check box is named "Temp"

the object to be hidden, a numeric field is named "LowTempLOFF"

In place of "True" I've also tried "1" and "on" to no avail.

To add, I want the object visible screen only - not print.

my current error states: accessor 'Temp.rawValue' is unknown

Greatly Appreciate any help!

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Did you save the form as a dynamic PDF? The presence changes will not work unless the form is a dynamic

PDF.

Paul

View solution in original post

6 Replies

Avatar

Level 7

Are you using LiveCycle Designer? If so, your script syntax is incorrect. Try this on the change event of the check box (formCalc):

if(Temp == "1")then

     LowTempLOFF.presence = "visible"

     LowTempLOFF.relevant = "-print"

else

     LowTempLOFF.Presence = "hidden"

endif

cheers,

Stephen

PS. there is good scripting information in the help function (F1)

Avatar

Former Community Member

Thanks - that seems to have taken care of all of my errors ...

however it's still not working.

I assume the error may lie in my settings with the object LowTempLOFF

In my object settings what should I have presence set to?  Whatever it is it overrides the script ...

Am I missing something that ties those settings to the Temp object?

Avatar

Level 7

Hi,

I assume you placed the script on the change event of the check box (it's not a radio button, right?). And, I assume you selected formCalc as the scripting language.

If you don't want the item visible normally: The presence property for LowTempLOFF should be set to "hidden" (if it's in a flowed subforms) or "invisible" (if it's in a positioned subform or if it's in a table as a cell).

The check box needs to have a value of On = 1, Off = 0 in the binding tab of the object pallet.

The other common errors include referencing the  LowTempLOFF incorrectly--if its not a sibling to the checkbox, you need to have the correct SOM--or if it is a radio button, the script belongs on the RadioButtonList (a.k.a. exclusion group) and not the radio button itself.

Good luck!

Stephen

Avatar

Former Community Member

Hi There,

Yes, all correct.  No errors ... but it still just won't work.  I've tried with multiple objects now.  Whatever Presence setting I set for the object is what I get, regardless of any script trying to change the presence setting.

Getting frustrated ....

Avatar

Correct answer by
Former Community Member

Did you save the form as a dynamic PDF? The presence changes will not work unless the form is a dynamic

PDF.

Paul

Avatar

Former Community Member

I did not.

Thanks - that has solved my problem !

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