Mask Input Field in WP Fluent Forms WordPress plugin
In WP Fluent Forms, Mask Input allows admins to set a certain format for users to follow when filling up a form. For instance, a phone number input field might allow 11 digits or 10 digits for a particular country to pass through; and most importantly, it might not allow passing inputs in any other format.
WP Fluent Form comes with five pre-defined masking formats. If these five formats are not enough for you, you can make customization as you wish. Let’s have a look at how to add Mask Input in fluent form.
- To add the Mask Input field to your form drag and drop the field from the available input fields.
- To enable customization, click on the edit icon you get when hovering over the field. Or click on the Input Customization tab in right sidebar when the field is selected.
- Select from the pre-defined mask formats, or create a custom mask.
- While creating a custom mask, abide by the following format.
– Use a ‘0’ / ‘#’ to indicate a numerical character.
– Use an uppercase ‘A’ to indicate an alphabetical character.
– Use an asterisk ‘*’ to indicate any alphanumeric character.
– All other characters are literal values and will be displayed automatically.
Examples:
Date Mask: 00/00/0000. Valid Input: 10/21/2011
Social Security Number Mask: 000-00-0000. Valid Input: 987-65-4329
Course Code Mask: AAA 999. Valid Input: BIO 101
License Key Mask: *-*-***. Valid Input: a9a-f0c-28Q
In the input customization tab, customize the mask input field.
In the Input Customization section, you will find different options like-
- Default Fields. 2. Advanced Options
Default Fields
In general fields section, there are some important options which are given below.
- Element Label: This is the text that users will see on the form for the input field. You can put any text here that helps to understand the purpose of that field.
- Label Placement: Determine the placement of the label, that you set previously, in respect to the input field. The available options are ‘Topâ, âLeftâ, âRightâ, âDefaultâ. All of those are self-explanatory except the âDefaultâ. What it means is, it will represent your global label placement settings.
- Admin Field Label: If you want to show a different label for your admin users when they view the form submissions you can configure that using this option. It doesnât have any actual effect on the form rather only for administrative purposes.
- Placeholder: You can also have a placeholder by which users will perceive the field subject.
- Mask Input: Select from the pre-defined mask formats, or create a custom mask.
While creating a custom mask, abide by the following format.
– Use a ‘0’ / ‘#’ to indicate a numerical character.
– Use an uppercase ‘A’ to indicate an alphabetical character.
– Use an asterisk ‘*’ to indicate any alphanumeric character.
– All other characters are literal values and will be displayed automatically.
Examples:
Date Mask: 00/00/0000. Valid Input: 10/21/2011
Social Security Number Mask: 000-00-0000. Valid Input: 987-65-4329
Course Code Mask: AAA 999. Valid Input: BIO 101
License Key Mask: *-*-***. Valid Input: a9a-f0c-28Q.
- Required: Determine whether the field could be empty or not when the user submits your form by choosing the appropriate option from here.
Advanced Options
The advanced customizations available for the simple text input fields are as followed:
- Default value: You can pre-populate the fieldâs value, means setting a default value, using one of the available options here. Letâs see what are the things we can do here.
– Populate by GET Param: sets the default value from the query string found in the URL. Make sure you keep the âget.â part otherwise it wonât work as you expected.
– IP Address: sets the value from the userâs IP address.
– Date (mm/dd/yyyy): sets the value from the current date in the denoted format, e.g. 04/25/1991.
– Date (dd/mm/yyyy): sets the value from the current date in the denoted format, e.g. 25/04/1991.
– Embedded Post/Page ID: sets the value from the current post or page ID.
– Embedded Post/Page Title: sets the value from the current post or page title.
– Embedded URL: sets the value from the current URL.
– User ID: sets the value from the logged in userâs ID.
– User Display Name: sets the value from the logged in userâs display name.
– User First Name: sets the value from the logged in userâs first name.
– User Last Name: sets the value from the logged in userâs last name.
– User Email: sets the value from the logged in userâs email.
– User Username: sets the value from the logged in userâs username.
– User Browser Client: sets the value from the logged in userâs browser name.
– User Operating System: sets the value from the logged in userâs OS name.
- Container Class: Use this option to add your custom CSS classes to the fieldâs wrapper.
- Element Class: Similarly, you can add custom CSS classes to the input field itself.
Help Message: To guide your user thoroughly you can use this option. Just add your text here and it will be shown as a help message to the user.
- Name Attribute: The input fieldâs name attribute is the HTML equivalent of the same name. You donât need to modify this.
Conditional Logic: You can create certain rules to dynamically hide/show the input field based on the values from some other fields. Read the article on conditional logic feature to get more control over your contact forms.