Toggle menu

Form Blueprints, Snippets and Smart Snippets

Creating and Using Snippets

Snippets are collections of fields that can be saved and reused on other forms. They are organised into groups and appear alongside the field types in the right hand panel of the forms designer. You can drag them onto your form and all of the fields in the snippet, including any JavaScript saved in them when the snippet was created, will become part of your form.

Create a snippet

You can create a snippet from the forms explorer in the same way as any other type of form. Right-click on the group where you would like to create a snippet and select "Create a form" then "Snippet".

Snippets can also be created when you are working in the forms designer. Right-click on a layout field with other fields inside it, and select "Save this field as a snippet".

iCM will prompt you to give the snippet a name and description. It will be saved in the same group as your current form (and can be moved later).

Using a snippet

Snippets in the toolbox are organised by the groups they are in.

Toolbox - Snippets

To add a snippet to your form, expand a group, then drag the snippet onto the page.

Once you have added a snippet to your form, the fields within it have no link to the original snippet, and are treated like any other fields on your the form. Updating the original snippet won't have any effect on the snippet fields that have been added to other forms. In other words, once added to a form, the fields in a snippet are no longer a snippet.

Field names in snippets

When you add a snippet to your form, if the names of any fields in the snippet conflict with any fields already on your form, they will be changed. For example, if you form already has a field called NAME, a field in the snippet called NAME would be renamed NAME2.

When a field in the snippet is renamed, the forms designer checks for any references to it within the snippet, and updates them too. This is to make sure that any JavaScript or templating within the snippet continues to function after a field name has been changed. This checking applies to field names in:

  • Default functions
  • Handler functions
  • Validation functions
  • Template manipulation functions
  • Buttons
  • The script action field
  • The history writing actions
  • The workflow actions
  • Handlebars templates that use the {{FIELD}} helper
  • Tokens that use the #FIELDNAME# field substitution

If you create form variables using the Form Variable field, and don't set a variable name (ie, you use the field name as the variable name) references to that name will be updated too. You'll see this when using the Handlebars {{VARIABLE}} helper and tokens that use the %VARIABLENAME% syntax.

Last modified on May 28, 2024

Share this page

Facebook icon Twitter icon email icon

Print

print icon