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.
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%>"]);