How to output Custom Field Set fields in a Form's Custom Layout

Default Form Layouts should be automatically updated with Custom Field Set fields. However, custom Form Layouts will need further syntax.


Before reading this Article you should have already:


This Article shows you the extra syntax needed to include Custom Field Sets in a custom Form Layout. Updating the Form in Admin will automatically add the Custom Field Sets to your default.liquid Layout, so these will not need any maintenance. The easiest way to make sure your Custom Form Layout is displaying Custom Field Sets correctly may be to copy the code straight from your default.liquid Layout.

Identifying your Custom Field Set

Each Custom Field set has an unique ID. You can find this ID by viewing the Custom Field Set in the Admin, and reading the last number in the URL.

Each field within that Custom Field Set also has it's own ID. You can work this out by the position of the fields in the List when you inspect your Custom Field Set in Admin. In the example below- I have a Custom Field Set with an ID of 5 (displayed in the last slug of the URL)- and two fields:

  • Pizza Topping appears first in the List- so has an ID of 1
  • Gelato appears second in the List, so has an ID of 2
Document image


We'll structure the sections of the Article by the type of field which needs to be displayed, because the key HTML attribute will be located on different elements depending on the field type. If the type does not fit any of the types here, you can use text.

When it comes to adding the data-cfsHTML attribute below, 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" 


A text input should have the data-cfs attribute inside the <input> element. 



The same applies for textarea inputs.



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. 



The same applies to a radio field. 



The data-cfs attribute should go on the <select> element itself, not on options.



The data-cfs attribute is on the hidden field, not on the element with type="file".