đģReference
Forms
Including a Form
The id refers to the specific form you wish to output.
Layout refers to either the:
The default layout which is created automatically by the system - this should not be edited directly as every time you modify the form fields, the default layout will automatically be updated. Any changes you make using CLI will be overwritten.
A custom layout allows you to decide which fields to output and how. You can fully customise it. In the parameter, you should include the file name with no extension, and any subfolders relative to the folder form_1 where the number matches the form ID.
Often you can save time by starting with a default layout and copying it to build your custom layout.
If you output two forms with the same ID, but different layouts, they may display different fields and look visually different, but they would use the same settings and their cases will be stored in the same database table.
Form Custom Layouts
The Form Tag
Every Form should contain the `{% form %} {% endform %}` opening and closing tags where the HTML form element's closing tags would normally go. These will output the HTML tag along with important, hidden system fields.
Learn more including how to pass HTML ID and class attributes:
https://documentation.platformos.com/api-reference/liquid/platformos-tags#form
Submitting a Form
Parameters:
The form's HTML attributes will change during each step of the form submit process:
form_x_submitting
class will be added for the duration of the submissiondata-s-form-progress="1"
data-attribute will be added and it's value changed at each submission step
File Upload Previews
OR for background images:
Custom Field Sets
For each type of field, you will need to use a slightly different syntax to include a Custom Field Set field in a Form Layout.
When it comes to adding the data-cfs
HTML attribute, the first number should be the CFS ID and the second number the CFS Field ID. Finally, the type should be specified and preceded by the string "input_".
E.g. data-cfs="5-1-input_text"
If you're not sure where to find these, see:
Steps to Using Custom Field Set fields in a Form's Custom Layout
Text
A text input should have the data-cfs
attribute inside the <input>
element.
Textarea
The same applies for textarea inputs.
Checkbox
A Checkbox group should have the data-cfs
attribute on the container for the entire group. <input>
elements should be the grandchildren of this group.
Radio
The same applies to a radio
field.
Dropdown
The data-cfs
attribute should go on the <select>
element itself, not on <option>
s.
File
The data-cfs
attribute is on the hidden field, not on the element with type="file"
.
Last updated