Join Now

Click here to join our
growing community:

JOIN LOGIN



Docs

Welcome Tour
Handbook
      Markups
      Variables
      Conditions
      Functions
      Forms
      Commands
      Concepts
Extensions
Pro Modules
Developers



Copyright © 2020
Terms of Use
Privacy Policy
BoltWire

Handbook

Radio Buttons

Radio buttons are simple input fields which allow you to choose between one or more options. To work properly, each item in the set needs to have the same field name. Here's a simple example:

[form]
[radio color 'red'] Red   [radio color 'blue'] Blue   [submit]
[form]

Red    Blue   

Here the field is color. Checking any of the buttons will uncheck all the others, and set the value to the appropriate color. If no value is selected, no value is returned.

You can control whether the box is checked initially by setting checked to the default value. Notice the following examples:

[form]
[radio color 'red' checked=red] Red
[radio color 'blue' checked=red] Blue   [submit]
[form]

Red
Blue   

If you want retrieve a saved value to create a more dynamic effect, set checked to some data or info var, and if it matches the value of that radio button, it will be checked. You will need to put the same checked={var} in each radio button. You can also wrap the entire checked=true parameter inside complex conditionals to create even more dynamic effects.

Additional Parameters

Other than required, there are no useful BoltWire parameters for this input type, as the value is preset by the form creator.

The required parameter conflicts with the HTML5 parameter, which is allowed. That is, if you set required=true, HTML5 browsers will block form submission--before BoltWire has a chance to. Older browsers will not recognize the parameter and ignore it, allowing BoltWire's check to kick in. If you want to rely fully on BoltWire so all users have the same experience, you can reset the HTML parameters allowed in config.php to not include "required". You can see the default value in variables.php.

By default the following html parameters are allowed:

name, value, size, maxlength, class, id, style, disabled, autofocus, required

To override the default message created when a form fails some input check, set msg to the value you wish, or set it to false to turn it off.

For information about how to insert javascript into a form element, please see that tutorial.