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 and the url attempts to prepopulate the field a 500 error will be thrown!!!

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 logged in 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.