0
votes

We are building a site using AEM, where we have lot of forms (login, change address, change email) that will POST their data to an external system using web service. We had achieved this by using "slingServlet", where we used to get values using “sling.getParameter(“ ”). With this approach we are fixed with the form components used inside the particular forms.

For example login form, we are using username and password parameter, but in future we decided to add “dob” field too. To achieve this we need to do the code changes again. By doing so I believed we are not leveraging the CMS concept. So the question is there any other way to achieve this without doing code changes.

1
what version of AEM are you using? I believe forms in AEM6 are offered as an additional feature which you need to subscribe to, whereas form components and be used in the manner you need in 5.6.1bongman1612
There will be a new form framework based on Adobe LiveCycle which will be released with AEM 6.1 This offers many features OOTB so if you can wait a few weeks, it might be an option for you.Thomas

1 Answers

0
votes

Instead of getting parameters by using sling.getParameter("") try using one of these instead

sling.getRequestParameterMap();

or

sling.getParamterMap();

This will give you a map of your parameters regardless of their name. Returns the parameters and name | value pairs.

Here are some helpful links: https://sling.apache.org/apidocs/sling5/org/apache/sling/api/SlingHttpServletRequest.html#getRequestParameterMap()

http://docs.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html#getParameterMap()