Expand my Community achievements bar.

SOLVED

How does FormsHelper.getOptions(SlingHttpServletRequest request, Resource elementResource) work?

Avatar

Level 1

From the com.day.cq.wcm.foundation.forms package, FormsHelper has a method called getOptions that returns the options for a form element.  How does it know the options for a form from the request and the elementResouce?


Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 10

It gets a ValueMap from a Resource[1]. Check for optionsLoadPath if true adopt the return into string array. Otherwise get default values from options properties.

[1]   http://dev.day.com/docs/en/cq/current/javadoc/org/apache/sling/api/resource/ResourceUtil.html

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

It gets a ValueMap from a Resource[1]. Check for optionsLoadPath if true adopt the return into string array. Otherwise get default values from options properties.

[1]   http://dev.day.com/docs/en/cq/current/javadoc/org/apache/sling/api/resource/ResourceUtil.html

Avatar

Level 1

Thanks for the quick reply!  I have successfully had optionsLoadPath pointing to a property which is a string array, but do you know how I can set optionsLoadPath to point to a script?  Are there any examples of this?