Prepopulation of AEM Form

Avatar

Avatar
Validate 10
Level 2
adeivasigamani
Level 2

Likes

4 likes

Total Posts

79 posts

Correct reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
Affirm 3
View profile

Avatar
Validate 10
Level 2
adeivasigamani
Level 2

Likes

4 likes

Total Posts

79 posts

Correct reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
Affirm 3
View profile
adeivasigamani
Level 2

15-10-2015

Hi Folks,

The url http://helpx.adobe.com/aem-forms/6/prepopulate-adaptive-form-fields.html details on how to pre-populate the fields of a AEM form, I have a requirement in which the user has to get the query parameter from the url and populate the filed of the form with that query param.

Lets say for example my AEM form is opened with a url such as http://localhost:4502/forms/myaccount.html?productID=HSBCurrentAccount

I need to populate the productID value from the query parameter into a text field in my Form, Note - that my form has a form model (XDP) ref.

For now, I am able to get my query param in my JSP with the code String productID = slingRequest.getParameter("productID");

But I am not able to assign it to the field that I have in my form. I tried with the following jQuery syntax like $('#myFiledInput').value('<%=productID%>'), but in vain

Please let me know if you guys have a way of populating a single field on Form load.

 

Regards -

Ashok D 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 5
Employee
mandeepg6805152
Employee

Likes

7 likes

Total Posts

47 posts

Correct reply

28 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 5
Affirm 3
View profile

Avatar
Boost 5
Employee
mandeepg6805152
Employee

Likes

7 likes

Total Posts

47 posts

Correct reply

28 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 5
Affirm 3
View profile
mandeepg6805152
Employee

15-10-2015

jQuery uses val() API and there is no value API in jQuery. Even if this workd this would be a hack. I would like to suggest few ways -

 

a. If the no of fields to prefill are in good in number then go with technique mentioned in "Setting Data  attribute in stringReuest" section.

b In case of less fields  please use the setProperty API guideBridget.setProperty(["SOME_EXP_OF_FIELD"], "value", ["<%=productID%>"]);

Answers (0)