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

Validation

BoltWire has fairly sophisticated tools to help you validate form input and even modify user submitted values. To use them, simply add an appropriate value in the input field itself.

Consider the following example:

[form]
[text test required=true][submit]
[form]

The required parameter returns a warning message if no value is supplied and will prevent the form from submitting.

BoltWire Paramters

The following parameters can be used to validate user input in forms:

required
This requires a value to be set in the input field. It works with all form inputs. (For the file input type it checks to see whether a file has been uploaded).

filter
Set this to any filter type defined in variables.php, like filter=numbers or filter=letters. Or you can define your own. You can also set it to any regular expression understood by PHP's preg_match function. (ex: filter=/pattern/).

if
Here you can tap into BoltWire's full conditional system. To insert values from fields, use regular field replacements. Use it to require a form passcode (if='equal {=field} passcode') or to verify two fields have the save value (if='equal {=email1} {=email2}'). If the conditional fails, the form aborts.

The following parameters can be used to modify user input in forms:

case
Set to upper (uppercase), lower (lowercase), initial (first letter only capitalized), or words (each word, initial capital letter).

trim
Set to true to trim extra white space from front and end, to left or right to trim one end of the user input only, or to a set of characters you want to trim from beginning and end (ie trim=',' to eliminate commas from either end).

strip
Set to true to eliminate pretty much all markup and some characters from user input. This is used by default in the title and data actions.

lines
Set to true to convert \n to line breaks (expand), and to false to convert line breaks to \n (condense). If not set, neither are changed.

csv
Set to true if the field is supposed to be a list of comma separated values (csv). It will trim each individual element of leading and trailing spaces. Can use +join or -drop if you provide a current= parameter with the existing value.

Note: These parameters are not very useful with buttons and input types whose values are defined by the form creator.

HTML Parameters

BoltWire recogizes and allows many HTML parameters for these input types including some newer HTML5 attributes like autofocus and required. These are defined in variables.php and can be changed by redefining the appropriate values in config.php.

The "required" parameter is an interesting one as it is both a BoltWire and an HTML5 parameter. HTML5 browsers will block form submission when a required field is missind. Older browsers will not recognize the parameter and allow the form to go forward.

BoltWire does its check on the server side to ensure a value has been submitted. It works with all user input fields including file uploads, and it works on all browsers. It can be used as a backup for browsers that are not HTML5.

Developers

If you want to change how BoltWire validates and modifies form inputs, you can use the webhook "myBOLTsecureForm" to override the default behavior. See the section on webhooks for more information.