/

CM Registration (CMREG) - How To - Hide or Display Fields Dynamically (Conditional Logic)


Hiding or Displaying Fields Dynamically (Conditional Logic)

Back to User Guide

What Is This Feature

Starting from version 2.8.0, it's possible to hide or display fields based on certain conditions.

Use Case Example

The registering user can choose between "Free User" or "Premium User" 
  • Choosing "Free User" displays the fields
    • Email
    • Password
  • Choosing "Premium User" displays the fields
    • Email
    • Password
    • Referral
    • Premium Plan

You can add one logical condition to either a required field or optional field. 

In both cases, the first option will hide the desired fields and the second option will display all. If there are three or more options, they will also display all fields.


Using This Feature

You must add certain tags to the CSS class of the relevant fields. 

First, edit the fields that will affect the conditions:

  • Optional fields - add hide_show_optional to the CSS class. Note: don't make affected fields Required!
  • Required fields - add hide_show_required to the CSS class

Then, edit the CSS class of the fields that will be affected.

  • Affected fields - add hide to the CSS class

Use Case Example - Part 2

Using the example from above, 
  • Field User Type (Free User/Premium User) - is an optional field, so you should add to the CSS class hide_show_optional
  • Email - Will always appear, so the CSS class won't change
  • Password -  Will always appear, so the CSS class won't change
  • Referral - Should be affected by the condition, so add hide to the CSS class
  • Premium Plan - Should be affected by the condition, so add hide to the CSS class

More information about the CM Registration and Invitation Codes Bar WordPress  Plugin

Other WordPress products can be found at CreativeMinds WordPress Store

Let us know how we can Improve this Product Documentation Page

To open a Support Ticket visit our support center