How to Preset Field Values on a Form
Use this technique to populate a field before the user views the form or to populate a hidden field. This is commonly done when calling subforms to pass values from the parent to the subform.
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.
Create a URL to the form that has the parameter ?values[FieldName]=VALUE
appended to the end. (the ? starts a query string and the & is used to append multiple parameters). Note that the name and value must be escaped (to account for special characters).
For example, loading a requested for subform may have a URL that looks like this:
K('kapp').slug()+'/requested-for?values[Login%20Id]='+identity('username')
This would populate a field called Login Id with the login user's username.
Keep in mind that many servers have a limit to the length of a URL. It is impractical and potentially problematic to set long text fields in this manner.
Updated 8 months ago