Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

3 Versions of Same Form Best Practice

Avatar

Former Community Member
I have to create a form that will be used in the US, UK & Australia. It will be relatively the same with only a few changes (address info, currencies, tax/VAT etc). What is the best way to do this without having to keep 3 seperate forms updated. I thought maybe using a drop down option in which they choose the country. That could trigger different text to populate etc. Seems like a lot of dependencies? Any suggestions?
6 Replies

Avatar

Level 10
I'd use subforms - you can have all three forms (or just the bits that need to be changed) in the same pdf and hide/show them based on the country selected.

Avatar

Former Community Member
Thanks Jono. So this is what I tried and did not work. I think I am approaching this wrong. Can you confirm the event type and formcalc or script? I don't know Java so this was my feable attempt.



I tried on exit and change. Neither worked.



if (this.rawValue == 1){

SUBFORM1.presence = "visible"

}else{

SUBFORM2.presence = "invisible"

SUFORM3.presence = "invisible"

}



if (this.rawValue == 2){

SUBFORM2.presence = "visible"

}else{

SUBFORM1.presence = "invisible"

SUFORM3.presence = "invisible"

}



if (this.rawValue == 3){

SUBFORM3.presence = "visible"

}else{

SUBFORM1.presence = "invisible"

SUFORM2.presence = "invisible"

}

Avatar

Former Community Member
That script that you are showing is javascript and not FormCalc.



The code looks OK. Are you sure you are rendering a dynamic form?

Avatar

Former Community Member
Does it matter that my List Box is on a master page and the subforms are not?



Also, I am not useing numbers ex: "if (This.rawValue == 1). Instead of "1" I am using words. I assume they should be in quotes?



Does it matter what type of trigger I use. I tried. Exit and Change. With the code in the List Box not the subforms.

Avatar

Former Community Member
The quotes indicate a string and not a number. It shoudl be on the exit event as the change event will not update the rawValue until you have left the field.



If you are still having issues send the form to livecycle8@gmail.com and I will have a look at it.

Avatar

Former Community Member
Thanks Paul it works.



1. Double check that the PreView display is set to Dynamic

2. My path to the objects were incorrect



Answer is to use an "if", "else" script.



Problem Solved.