Contact Us Form: With Callback
A contact us form where the number of guest fields displayed is determined by the value of a field specified by a parameter.
Two parameters are required; the callback paramter are optional.
show_guest_info_fields => 1
to render the guest fieldsguest_number_field => field_name
ornumber_of_guests => x
loop_guest_fields_callback => functionName
which executes asdisplayGuestFields()
loops through the guest field blocks to display
The callback moves full name above email address and also toggles the display of the "Extra Info" field if the value in the select is "Other Thing". For callbacks that call vanilla.toggleFormContent
, you also need to add the optional_guest_fields
parameter if the toggled element is a form field, since it can be hidden.
Callbacks should be placed either in the story itself in an open_format_item
, at the bottom of site.js, outside of the DOMContentLoaded
block, or in vanilla.pageStyle.js
(preferred).