Skip to content

Custom Default Value

Vijaivir Dhaliwal edited this page Mar 28, 2024 · 29 revisions

This documentation is no longer being updated. For the most up to date information please visit our techdocs

Home > CHEFS Components > Custom Components > Custom Default Value


Examples

Example user field:

{
  "username": "naomiaro",
  "firstName": "Naomi",
  "lastName": "Aro",
  "fullName": "Naomi Aro",
  "email": "[email protected]",
  "idp": "idir",
  "public": false
}

You can give your form fields a custom default value, including details about the currently logged in user.

Custom Default Values are only available on Advanced Fields.


Custom Default Value (Tutorial)

On this page:

Getting the Current User's Email

Back to top

To setup a form field which will default to the currently logged in user's email address, start by dragging over a new Advanced Fields > @ Email form field

When the editor opens, navigate to tab Data and scroll down to open the section named Custom Default Value. Inside the Javascript section you need to write

value = user.email;

and then save your email component progress.

To make sure all custom defaults are loaded properly you can open your form preview or refresh your form designer page.

Form Preview

Form Designer

Tips

Back to top

For further insight into what is available from the variables in the table - an easy way is by entering

value = JSON.stringify(token);
Clone this wiki locally