How does FormsHelper.getOptions(SlingHttpServletRequest request, Resource elementResource) work? | Community
Skip to main content
daniel_tong
New Participant
October 16, 2015
Solved

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

  • October 16, 2015
  • 2 replies
  • 651 views

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sham_HC

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

2 replies

Sham_HC
Sham_HCAccepted solution
New Participant
October 16, 2015

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

daniel_tong
New Participant
October 16, 2015

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?