âšī¸Front-end Submit Modules
When you install a Module, a front-end form file is automatically generated within your Module, in a folder called form
. It automatically contains all fields from the Module. You can view this folder using Code Editor, it is next to the detail
and list
folders for your Module.
Syntax
Output your Module form on a page: <div data-gb-custom-block data-tag="-" data-0='module_form' data-1=', id: ' data-2='1' data-3='1'></div>
Toolbox has support for Module input forms, and the following options will be given in the modal, or you can set them yourself:
enabled
- default isfalse
- Boolean - Determines if items are auto-enabled or notexpiry_date
- default isnever expires
- Timestamp - When the new item will expirerelease_date
- default isas soon as the form is submitted
- Timestamp - When the new item will be releasedupload_dir
- String - default isdocuments/form_uploads/module_1/
Where uploaded files will be stored. Must follow this format - 'folder/optional_folder/'
Standard Fields
Some fields are required for the form to be able to set up the Module items correctly. These fields are for 'enabled', 'expiry_date', 'release_date', 'upload_dir', and 'slug'. They stay the same each form, and don't have a Module specific ID attached to them.
All forms should be wrapped in a Liquid form tag: <div data-gb-custom-block data-tag="form"></div>
All forms need a submission button:<button onClick="s_form_submit_v2(this,'module_1')">Submit</button>
Category Field (optional)
Example 1
This example can be used for a Module Submit form that is displayed within a the layout of another WebApp or Module.
this.category_array[0]
- finds the first category the current item is categorised to and can be changed to be a full array, or specific category ID.
Example 2
This example can be used on pages other than WebApp and Module layouts.
123456
- replace with the ID of a category of your choice.
Location Field (optional)
You can submit a Location value for a Module item as shown in the following example:
The value should be a stringified JSON object.
Last updated