How to Preset Field Values on a Form
Overview
You can configure a form to populate a field before a user views it or to populate a hidden field. This is commonly done when calling subforms to pass values from the parent to the subform.
Process
To preset a field value on a form, create a URL to the form with the following parameter appended to the end of the URL: ?values[FieldName]=VALUE
. The name and value must be escaped to account for special characters. The question mark starts a query string. You can also use ampersands to append multiple parameters.
Warning! If the field specified does not exist on the form, you will receive a 500 error when the URL attempts to prepopulate the field.
Example
Loading a "Requested For" subform might have a URL that looks like this:
K('kapp').slug()+'/requested-for?values[Login%20Id]='+identity('username')
This would populate the Login Id field with the login user's username.
Note: Many servers have a limit to the length of a URL. This method is not recommended for setting long text fields.
Updated 10 months ago