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.
SOLVED

Hidden Subforms

Avatar

Former Community Member

Good Afternoon All,

I am not very familiar with subforms, so PLEASE help!

I have created a file with a drop down box called "Applicant Type". There are 4 possible values in this box: "Individual" "Partnership" "Assocation" and "Corporation".

I have created 4 subforms with corresponding names: "IndividualSub" "PartnerSub" "AssociationSub" "CorporationSub". All of these subforms are "hidden" in the Initialize Event of each one.

I am trying to create a script that makes the appropriate subform become visible when the corresponding option is selected from the drop down box.

I have inserted this script in the Change event of "Applicant Type" (FormCalc, Client):


if ($.rawValue==3) then IndividualSub.presence="visible" else IndividualSub.presence="hidden" endif

if ($.rawValue==2) then PartnerSub.presence="visible" else PartnerSub.presence="hidden" endif

if ($.rawValue==1) then AssociationSub.presence="visible" else AssociationSub.presence="hidden" endif

if ($.rawValue==0) then CorporationSub.presence="visible" else CorporationSub.presence="hidden" endif

The first time I activate the drop down, nothing happens. Each subsequent activation of the drop down makes one of the subforms appear, BUT, usually not the correct one. If I select "Corporation", I may get the "AssociationSub", etc.

I am using LiveCycle Designer ES2 v9

I would be glad to upload the file for anyone to look at, if you will provide me instructions on how to do so.

thanks in advance!

Gene-O

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

if (event.newText=="Individual") then IndividualSub.presence="visible" else IndividualSub.presence="hidden" endif

if (event.newText=="Partnership") then PartnerSub.presence="visible" else PartnerSub.presence="hidden" endif

if (event.newText=="Assocation") then AssociationSub.presence="visible" else AssociationSub.presence="hidden" endif

if (event.newText=="Corporation") then CorporationSub.presence="visible" else CorporationSub.presence="hidden" endif

I am assuming the rest of your syntax was already correct. I rarely use FormCalc. I mostly use JavaScipt.

View solution in original post

4 Replies

Avatar

Former Community Member

Try using event.newText instead of $.rawValue which is giving you the old value.

Avatar

Former Community Member

thanks for your reply, BUT, I'm not familiar with this at all. Can you give me an example of how to insert it into my script?

thanks!

Avatar

Correct answer by
Former Community Member

if (event.newText=="Individual") then IndividualSub.presence="visible" else IndividualSub.presence="hidden" endif

if (event.newText=="Partnership") then PartnerSub.presence="visible" else PartnerSub.presence="hidden" endif

if (event.newText=="Assocation") then AssociationSub.presence="visible" else AssociationSub.presence="hidden" endif

if (event.newText=="Corporation") then CorporationSub.presence="visible" else CorporationSub.presence="hidden" endif

I am assuming the rest of your syntax was already correct. I rarely use FormCalc. I mostly use JavaScipt.

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