Toggle menu

Radio Button Accordion

This field type has many of the same options as the standard Radio Button Group field, but also includes layouts beneath each button. It creates a vertical set of radio buttons that a user can pick from. When an option is selected, a layout field is revealed which can contain any other fields that can normally be placed in a vertical layout.

The field automatically handles all of the show-hide logic, and, when the page is submitted, will clear the values of any fields in layouts for radio buttons that haven't been selected (eg a user picks one radio button, fills out the revealed field, then changes their mind and picks another).

When the page the radio button accordion is on is submitted, the value of the layout will be the value of the selected radio button. Any fields revealed in the layout behave in the same way as fields placed into any of the usual layout fields.

Note that any Action Fields placed in the layouts will be executed, even if the corresponding radio button hasn't been selected.

If a field is "required" it will only become required if the corresponding radio button for the layout has been picked. Similarly, validation functions will only be triggered for revealed fields.

Properties

LabelDescriptionType Name
LabelThe label for this fieldLABEL
Show BorderWhether to show a border around this field or not. This property adds/removes a class on the field. The styling itself is controlled by the site's stylesheetSHOWBORDER
Show LabelWhether to show the label for this field or not. This property adds/removes a class on the field's label element. The styling itself is controlled by the site's stylesheetSHOWLABEL
HintAdditional information displayed alongside the field to assist the user in completing it. The value of another field can be used by adding the field's name between # characters. See Common Field Properties for more informationHINT
DefaultA default value for the fieldDEFAULT
RequiredWhether or not the field is required to have a value to pass validationREQUIRED
Error MessageThe error message that will be displayed if this field fails its validationERRMSG
Error Message FunctionA function that can be used to override the default error message. You can return a different message for each error type. The message can include the value of another field can be used by adding the field's name between # characters. See Error Message Functions for more information.

This field has the following error types:
 
  • REQUIRED - the field is required but has been left blank
  • VALIDATIONFUNCTION - the result of a custom validation function failing (validation function can also return custom error types)
  • VALIDATION - guards against the values being manipulated
ERRMSGFUNC
SearchableWhether this field's value should be indexed by the search (the object collection if using the database save action and/or workflow process collection if starting a workflow process).

This property is ignored if an External Type is specified for the form. In this case, the ability to search is determined by the searchable property of the type itself
SEARCHABLE
Options

The values to be included in the group. Use the popup editor provided to set the Value and Display value for each radio button in the group. These values may be hard-coded (fixed) or dynamically loaded from a datasource.

Hard-coded values can be entered using the grid provided on the 'Fixed' tab of the popup editor. Alternatively, they can be supplied as comma-separated values (value,display) via the 'Fixed (CSV)' tab, each row representing a single item in the list.

Dynamically loaded values are set via the 'Datasource' tab of the popup editor. Typically, specifying the table, value, display and order by column names in the boxes provided will generate a suitable query. A custom query can be entered by expanding the 'Advanced' section; it will use any names set in the above boxes to generate a starting query. This custom query should select the value into a 'DataValue' column, and the display value into a 'DataDisplay' column. For example: SELECT ValueColName as DataValue, DisplayColName as DataDisplay FROM TableName ORDER BY OrderByColName ASC  

Once you have entered some options, the forms designer will reveal layout fields within this field that you can drop other fields into.

OPTIONS
Options FunctionA server-side JavaScript function that can manipulate the options list at the time the field HTML is generated This function will be executed server-side only.

For example the following will replace any fixed or database query options with 10 numbered options:

function (helper, optionData) {    
    optionData = [];    
    for (var i=1; i <= 10; i++) {
        optionData.push([i.toString(), "Option number " + i]);
    }    
    return optionData;
}
OPTIONSFUNC
Validation FunctionA JavaScript function that can be used to provide custom field validation whenever the field value changes or the form is submitted. This function will be executed client-side, provided JavaScript is enabled in the browser, and repeated server-sideVALFUNC
Default FunctionA JavaScript function that can be used to calculate the default field value. This function is executed server-side when the field HTML is generated and is useful when the DEFAULT property is insufficientDEFFUNC
HandlersA JavaScript function that is executed client-side whenever the page loads, or the field value changes. This function is useful for modifying the values of other fields based on an entered valueHANDLERS
Read OnlyDisplay the field as read onlyREADONLY
ValidationThis property provides an extra level of validation by checking that the selected value is one that was present in the field's optionData when the field was first generated.

None - No additional validation is performed

Validate - When the field is generated its options are saved in a server-side variable. The submitted value is checked against this list of options and will fail validation if not present
VALIDATION
Additional Styling ModifierAn optional CSS modifier for the field. See Common Field Properties for an exampleADDITIONALSTYLINGMODIFIER
DocumentationAdd documentation to your field to help explain any complex functionality to future users. You might include information on what the field does and how it relates to other fields on the form. Notes added here are only ever visible in the Forms Designer, they can be searched for, viewed and downloaded from the action panel. See Common Field Properties for an exampleDOCUMENTATION

Example

Download the example:  (ZIP) [2KB]

Share this page

Facebook icon Twitter icon email icon

Print

print icon