Solved it :)
Can you throw some light on what was the problem and what were the steps taken to solve it ? Also, with 6.2, we have introduced a much simpler and manageable way to prefill forms with the notion of "prefill service", the documentation of this would be live soon.
it needs to be <data> and not <dataRoot> as stated in the documentation. Submitting a form saves the form data in CRX, if you download the 'data' element you can look at the actual XML structure. Pre-filling needs to have the same structure.
Also, pre-filling can only be viewed in WCM Mode disabled, not in preview mode.
I am working on AEM forms too,
I also have tried to use prefilling of form by using data attribute but its not working.
Even tried the things you have suggested, still facing problem.
Please help me
Here is the data attribute:
The Form is without any data model and containing only two textbox with name "textbox1" and "textbox2"
try the following steps first
1.Set the form's submit action to "Store Content". Preview the form and enter some value in the text fields
2.Submit the form
3.go to the node where the form's data is submitted. Get the data xml from the jcr:data node. Save the data xml as a xml file on your file system
4.Preview you form with the data xml stored in the previous steps
5.The forms should prepopulate with the data from the xml file
6.Then make sure the data that you are passing in your code matches the structure in the xml file which you got in step 4
I have already done so,
The xml i got was
<?xml version="1.0" encoding="UTF-8"?><afData>
taking it as a base i set the data attribute , just removed unnecessary tags from above xml
import org.apache.jackrabbit.api.security.user.Authorizable ;
i have used the following
UserManager um = ((JackrabbitSession) session).getUserManager();
Authorizable loggedinUser = um.getAuthorizable(session.getUserID());
System.out.println("The path of the user is"+loggedinUser.getPath());
System.out.println("The family name is "+loggedinUser.getProperty("profile/familyName").getString());
suggest you use prefill service to populate forms , instead of doing it in the JSP page