FORMS
How to output Custom Field Set fields in a Form's Custom Layout
10min
default form layouts should be automatically updated with custom field set fields however, custom form layouts will need further syntax prerequisites before reading this article you should have already created a custom field set created a form added your custom field set to the form introduction 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 syntax 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 cfs html 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" 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 rare medium radio the same applies to a radio field radio 1 radio 2 dropdown the data cfs attribute should go on the \<select> element itself, not on options dropdown 1 dropdown 2 file the data cfs attribute is on the hidden field, not on the element with type="file" file