Expand my Community achievements bar.

SOLVED

pre-built form country drop down question

Avatar

Level 1

I am trying to build a custom AEM 6.1 form template with the standard fields our company uses. To that end I want to pre-fill the country, state, and province drop down on the template or even the page component.

 

I saw the article on creating a pre-filled drop down (https://docs.adobe.com/docs/en/aem/6-1/develop/components/developing-forms.html#Preloading%20Form%20...) but what I cannot figure out is how to call or assign the property of the Items Load Path field in CRXDE lite on the template?

Someone has to have encountered this and solved it before? Suggestions?

1 Accepted Solution

Avatar

Correct answer by
Level 3

You have a couple of choices then (IMO). You could create a custom component that could be dragged & dropped from your Adaptive From component list. Or a much simpler approach, create all of your standard items in your form, then when complete, turn each of the elements, or groups of common elements into Form Fragments. All those fragments could be used across all your form sets. In particular, very useful for headers, and common sections of forms that you need to be consistent.

To create the fragment, simply select the panel, then select "Save as Fragment". 

View solution in original post

5 Replies

Avatar

Level 3
  • Under /etc/designs/yoursite create a folder (jcr:primaryType is sling:Folder)
  • Enter the name of the property that you'd like to use as your value(s). Type should be String with either a single or multiple value.
  • For dropdown lists, add your items one at a time in the format of value=description, ie: US=United States.

Be sure that you're in the /etc folder so your form will be able to get to the values on a publish instance.

In your form object, change the Items Load Path to the full path of your variable: /etc/designs/yoursite/formlistvalues/provState, for example. In this case, "formlistvalues" is the folder name and "provState" is the name of the property holding the values.

Avatar

Level 1

Thank you! However, I do not want the author to have to learn or remember the  Items Load Path.

Instead, in the form's template I want to include a dropdown item of sling:resourceType = /libs/fd/af/components/guidedropdownlist that has the contents of the countrylist I created already in it.

Avatar

Correct answer by
Level 3

You have a couple of choices then (IMO). You could create a custom component that could be dragged & dropped from your Adaptive From component list. Or a much simpler approach, create all of your standard items in your form, then when complete, turn each of the elements, or groups of common elements into Form Fragments. All those fragments could be used across all your form sets. In particular, very useful for headers, and common sections of forms that you need to be consistent.

To create the fragment, simply select the panel, then select "Save as Fragment". 

Avatar

Level 1

Yes, I think that will do it. Going to try the fragment approach first. Hoping it will be intuitive enough for our authors. cheeky

Avatar

Level 3

Fragments are very simple, are indexed for search, and show up right in the components list so it should be really easy for your authors to find and use. Note that you can also integrate code into the elements of a fragment so if you find yourself repeating tasks, they are a great tool to avoid repeating of both visual and logical elements.