Set the readonly pre-fill parameter when you pre-populate a user ID (e.g. For example, to make the first and third fields readonly, you would add pf_ro1=1 and pf_ro3=1 to URL parameters.
When populating an input field, you can specify that its value should not be changed by the user with the readonly pre-fill parameter pf_ro. ) and filling out all fields, including those intended to be pre-populated and made read-only. This is to prevent someone from accessing the form at its base URL (e.g. Note that once a form was populated with data at least once, it can no longer be used without providing prefill parameters. This works “out of the box” there is no need to activate this feature in your FormSmarts account. Don't worry though, you can easily find out the index of a field and the name of its the pre-fill parameter with the Form API.Īny form can be pre-filled by providing field values in the form URL. So the label is Field 3, the first checkbox Field 4, the second checkbox Field 5 and the last one Field 6. Checkbox lists are a bit tricky: the label “Field 3” and each individual checkbox in the checkbox list is considered here to be an individual field.For checkboxes and items of a checkbox list, set the value of the prefill parameter to yes to check the corresponding box (Fields 4 and 6).
Fields 2 and 7), set the prefill parameter to the value of the option you want to select
We get access to the logged in user, and then fetch the logged in user’s profile information.
#PREFILL SEARCH FORM SCRIPTCASE CODE#
In the code snippet below we have a class which implements DataProvider interface. The following sample code fetches the user profile information of the logged in user and constructs an XML document whose input stream is returned to be consumed by the adaptive forms. In this method, you can fetch the data from any source and return input stream of data document. The method getPrefillData will have the logic to build and return data that adaptive form will consume to prepopulate the fields. To prefill adaptive form using the prefill service, you will have to create a class which implements the DataProvider interface. To learn more about various methods to pre-populate adaptive forms, please follow this documentation In this article, we will look at prefilling adaptive form using AEM Forms prefill service. There are multiple ways to prefill adaptive forms fields. When a user opens a form, the values for those fields are prefilled. You can prefill the fields of an Adaptive form using existing data.