A Cozmoslabs Product
Documentation / Form Fields / Select2 (Multiple)

Select2 (Multiple)

This Extra Field Type is available in Profile Builder Basic, Pro, or Agency.

There aren’t that many special steps compared to a regular Select (Multiple) field. According to your needs, you can choose a field title, a description, the options and labels you want your user to select, a default selection, whether the field is required or not, and even a conditional logic rule.

But with the Select2 (Multiple) field you also have new settings like: Maximum Selections and User Inputted Options.

Note – When the WooCommerce plugin is activated user inputted options are not visible in the WordPress Default Edit Profile page. On Profile Builder forms user inputted options work as expected.

Front End – User Side

You can see the fields we just created in action on this Registration form.

Profile Builder Pro - Select2 -Multiple - Registration Form

When users start typing in the Select box, the list is filtered automatically.

Profile Builder Pro - Select2 - Registration Form Select2 (Multiple)

Now let’s add a new option in the “Topics of Interest” field. You will see the warning message when you try to enter a fourth option.

Profile Builder Pro - Select2 - Registration Form Select2 (Multiple) Restriction

 

Advanced customization using filters

If you have a large set of data or you want to load it from a local or an external database you can use the filters for the Single Select field:

And for the Multiple Select field:

Here is an example:

/* Load select data using custom code */
add_filter('wppb_select2_options', 'wppbc_data_for_select2', 10, 6);
function wppbc_data_for_select2( $select2_data, $form_location, $field, $user_id, $field_check_errors, $request_data ) {
    $select2_data="Red, Green, Blue, Yellow"; // add your own data as comma separated values
    return $select2_data;
}

Select2 is implemented using an open-source library. So far Profile Builder’s user interface lets you use some of its features but you can implement more features such as a template. The PHP code you need to create, for further customization, should be hooked to one of the available filters:

Here is a link to some examples of what can be done using Select2 library.

Profile Builder Pro

Create beautiful front-end registration and profile forms with custom fields. Setup member directories, custom redirects, cutomize user emails & more using the all in one user management plugin.

Get Profile Builder

The Ultimate Membership Bundle

Combine the power of Profile Builder with Paid Member Subscriptions to set up user registration, memberships, and recurring revenue.

Get 25% off with the bundle

Help & Support

We’re here to help you every step of the way.

Open a Support Ticket