Expand my Community achievements bar.

SOLVED

Prepopulating Forms with User Data

Avatar

Level 4

I'm looking at the documentation for information regarding prepopulating forms with User data:  

http://helpx.adobe.com/aem-forms/6/getting-started.html

I couldn't find the description of the available options.  

I would prefer not to pass a parameter query string with the data.  If a user is authenticated to a session, is there someway the session can look up the data and populate it server side (securely)?  If I can see the proposed options in the documentation, that would be great!  

1 Accepted Solution

Avatar

Correct answer by
Level 1

For your usecase, you can also set data attribute in slingRequest,  where data attrbite is string containig XML tags.

<% String dataXML="<afData>" + "<afUnboundData>" + "<dataRoot>" + "<first_name>"+ "Tyler" + "</first_name>" + "<last_name>"+ "Durden " + "</last_name>" + "<gender>"+ "Male" + "</gender>" + "<location>"+ "Texas" + "</location>" + "</dataRoot>" + "</afUnboundData>" + "</afData>"; slingRequest.setAttribute("data", dataXML); %>

Here is a simple snippet which does something similar. You can write a simple XML string containing all your data and set it in slingRequest. 

This can easily be done in some of your renderer jsp for any of your component, which you are sure to include in page where you can set slingRequest data attribute. Let's take an example where you want a specific design for your page  (some specific kind of header and footer) . To achive this you write your own header.jsp or/and footer.jsp which you include in your page component [1]. You can set this data attribute there

[1] http://helpx.adobe.com/aem-forms/6/creating-custom-adaptive-form-themes.html

Document on Prepopulating Customized Adaptive Forms would be made public soon.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 1

For your usecase, you can also set data attribute in slingRequest,  where data attrbite is string containig XML tags.

<% String dataXML="<afData>" + "<afUnboundData>" + "<dataRoot>" + "<first_name>"+ "Tyler" + "</first_name>" + "<last_name>"+ "Durden " + "</last_name>" + "<gender>"+ "Male" + "</gender>" + "<location>"+ "Texas" + "</location>" + "</dataRoot>" + "</afUnboundData>" + "</afData>"; slingRequest.setAttribute("data", dataXML); %>

Here is a simple snippet which does something similar. You can write a simple XML string containing all your data and set it in slingRequest. 

This can easily be done in some of your renderer jsp for any of your component, which you are sure to include in page where you can set slingRequest data attribute. Let's take an example where you want a specific design for your page  (some specific kind of header and footer) . To achive this you write your own header.jsp or/and footer.jsp which you include in your page component [1]. You can set this data attribute there

[1] http://helpx.adobe.com/aem-forms/6/creating-custom-adaptive-form-themes.html

Document on Prepopulating Customized Adaptive Forms would be made public soon.