BoxLang 🚀 A New JVM Dynamic Language Learn More...

PresideCMS Extension: Validation Extras

v1.2.1+0000043 Preside Extensions

Preside Validation Extras

A collection of useful additional validators for use with Preside's forms system.


box install preside-ext-validation-extras

The validators


Makes a field required if another specified checkbox field is checked.

<field name="subscribe"     control="checkbox" />
<field name="email_address" control="emailInput">
	<rule validator="requiredIfOtherFieldChecked">
		<param name="otherField"   value="subscribe" />
		<param name="checkedValue" value="1" />


Makes a field required if another specified checkbox field is not checked.

<field name="use_billing_address" control="checkbox" />
<field name="shipping_address">
	<rule validator="requiredIfOtherFieldNotChecked">
		<param name="otherField"   value="use_billing_address" />
		<param name="checkedValue" value="1" />


Makes a field required if another specified field is empty. In this example, at least one of the inputs would have to be filled.

<field name="input_one">
	<rule validator="requiredIfOtherFieldEmpty">
		<param name="otherField" value="input_two" />
<field name="input_two">
	<rule validator="requiredIfOtherFieldEmpty">
		<param name="otherField" value="input_one" />


Makes a field required if another specified field is not empty. In this example, if one input is filled then the other is also required.

<field name="address">
	<rule validator="requiredIfOtherFieldNotEmpty">
		<param name="otherField" value="postcode" />
<field name="postcode">
	<rule validator="requiredIfOtherFieldNotEmpty">
		<param name="otherField" value="address" />


Makes a field required if the value of another field matches the specified value. Here, if "Yes" is chosen from the subcribe select control, then the email address is required.

<field name="subscribe"     control="select" values="yes,no" />
<field name="email_address" control="emailInput">
	<rule validator="requiredIfOtherFieldValue">
		<param name="otherField"      value="subscribe" />
		<param name="otherFieldValue" value="yes" />


Makes a field required if the value of another field matches systemSetting. In this example, if the ethnicity value matches the value on systemSetting ( category="lookup", setting="ethnicity_other" ), then the ethnicity_other field will be required

<field name="ethnicity"       control="objectPicker" object="ethnicity" />
<field name="ethnicity_other" control="textInput">
	<rule validator="requiredIfOtherFieldMatchSystemLookup">
		<param name="otherField" value="ethnicity"       />
		<param name="category"   value="lookup"          />
		<param name="setting"    value="ethnicity_other" />


Checks for a simple web URL. Requires either http:// or https:// at the start.

<field name="website_url">
	<rule validator="simpleUrl" />


Validates a phone number is valid for the UK. Allows brackets, spaces, +44 or 0 prefix, and an optional extension following a #.

<field name="telephone">
	<rule validator="ukPhone" />


Validates a UK postcode format. Valid with or without a space in the middle.

<field name="postal_code">
	<rule validator="ukPostcode" />


Validates a UK driving licence number.

<field name="driving_licence">
	<rule validator="ukDrivingLicence" />


Contribution in all forms is very welcome. Use Github to create pull requests for tests, logic, features and documentation. Or, get in touch over at Preside's slack team and we'll be happy to help and chat:



  • Update build version generator


  • VALIDATION-5 - requiredIfOtherFieldInValues to allow required for multiple values
  • VALIDATION-4 - Add rule for a field to be required if other field match system config


  • VALIDATION-3 - requiredIfOtherFieldValue should work with radio lists


  • VALIDATION-2 - i18n missing on error label when "required if checkbox checked" fields are not filled in


  • Further fix to Javascript validator for requiredIfOtherFieldChecked


  • Use correct i18n error message for simpleUrl validator


  • Use Github Actions for building and deploying
  • Fix Javascript validator for requiredIfOtherFieldChecked

$ box install preside-ext-validation-extras

No collaborators yet.
  • {{ getFullDate("2019-02-11T13:28:09Z") }}
  • {{ getFullDate("2024-02-22T10:42:27Z") }}
  • 2,675
  • 79,726