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

Text Field

Here's how you do a basic text input field:

[form]
[text color 'red' required=true][submit]
[form]


Here the field is color and the value is red. Normally the default value is set to some existing data or info variable, but it can be hardcoded like this. If there are spaces in the value parameter, be sure to enclose them in quotes.

Here's a slightly more sophisticated input field, which uses the source function to do the same thing, but it also preserves user post values whene a form aborts. Here's the whole form so you can see try it:

[form]
[text color '<(source some.page:color post=color default=red)>'] [submit]
[command warn 'Form Aborted']
[form]


Basically, the source function checks if a color post value has been submitted. If so, it returns that value. If not, source looks for a color data value on some.page. If no value is found, it returns the default.

I've added the warn command to abort the form, so you can see how the value is preserved when the form fails--even though it has not been saved in any way.

Additional Parameters

BoltWire accepts the following parameters to filter and/or modify user input:

required, filter, if, case, trim, fmt, strip, lines

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, autocomplete, readonly, 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.