|Discourse Authentication Validations enables the ability to add custom validations to a User Field to toggle the display of User Fields on the Signup Modal.
|How to install plugins in Discourse
Discourse Authentication Validations adds the ability to add custom validations to a User Field to toggle the display of User Fields on the Signup Modal. This allows you to “chain” User Fields together, so that a User Field is only displayed if a previous User Field has a specific value.
The Discourse Authentication Validations plugin can be enabled either by the toggle or from its settings, both accessible from your
After the Discourse Authentication Validations plugin has been enabled you will see a Include a Custom Validations checkbox at the bottom of your User Field form.
When checked it will display an additional two fields:
- Show Values
- Target User Fields
When a User Field has a
show values value included it will watch the value of the attached input until the input value matches ANY of the
show values. It will then toggle the visibility of any included
Target User Fields, making them visible.
In the Target User Fields dropdown you will see a list of all available User Fields. Any User Field you select will have their visibility toggled by corresponding values in
You can chain User Fields together by adding custom validations to multiple User Fields.
For example, let’s say we have three User Fields with the given values:
|Has Custom Validation
|Target User Fields
Input Two and Three will be hidden by default as they are “children” of Input One. When the
show value of
show-field-two is added to Input One, Input Two will be displayed, but Input Three will still remain hidden. It will remain hidden until Input Two has the value of
With the correct combination of Show Values and Target Classes you can infinitely nest User Fields beneath each other.