When you allow events to include an RSVP a set of default form fields are included in the registration form.
The default fields include the following:
- Attendees (required)
- First name (required)
- Last name (required)
- E-mail address (required)
- Phone
- Comments
You can use $_LW->CONFIG[‘RSVP_FIELDS’] to add custom fields.
- Custom fields can be applied to all calendars using ‘global’ or indicate the group id as shown below (ex., ‘3’) to add custom fields to a specific calendar group
- Each field is configured as an associative array where a value can be set to a key
- header: This is the label of your form field
- instruction: Include instructions if necessary by entering a brief description
- is_required: Make the field required by setting to “true” else set to “false” if optional
- type: Indicate whether this field is ‘select’,’radio’,’checkbox’, or ‘text’ input field. If not indicated, a text field will be used by default.
- options: If a ‘select’,’radio’, or ‘checkbox’ is used create an array of options for field values.
These custom fields will be added as options to the editor that will need to be enabled/disabled on a per-event basis. If you’d like to customize whether they get automatically included on new events, you could do so with some backend.js custom code.
Below is an example configuration of custom RSVP form fields with selection lists, radio, checkbox options.
$_LW->CONFIG['RSVP_FIELDS']=[
'global'=>[
'color' => [
'header'=>'Color',
'instruction'=>'Enter your favorite color',
'is_required'=>true
]
],
'3'=>[
'word' => [
'header'=>'Word',
'instruction'=>'Enter your favorite word',
'is_required'=>false,
'type'=>'text'
],
'letters' => [
'header'=>'Letters',
'instruction'=>'Choose a letter',
'is_required'=>false,
'options'=>['A', 'B', 'C'],
'type'=>'select'
],
'number' => [
'header'=>'Number',
'instruction'=>'Choose a number',
'is_required'=>false,
'options'=>[2, 4, 5],
'type'=>'radio'
],
'animals' => [
'header'=>'Animals',
'instruction'=>'Choose animal(s)',
'is_required'=>false,
'options'=>['lion', 'tiger', 'bear'],
'type'=>'checkbox'
],
'longtext' => [
'header'=>'Longer text field',
'instruction'=>'You can type more here',
'is_required'=>false,
'type'=>'textarea'
]
]
];