Select2

The Select field is available in every version of Profile Builder.

There aren’t any special steps compared to a regular Select 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, if the field is required or not and even a conditional logic rule.

Profile_Builder_Select2_Add_Field

Front End – User Side

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

Profile_Builder_Select2_Registration_Form

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

Profile_Builder_Select2_Registration_Form_Select2

Avanced custimization using filters

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

  • wppb_select2_options
  • wppb_select2_labels

Here is an example:

1
2
3
4
5
6
/* 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 the available filter:

  • wppb_select2_arguments

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.

Unlock PRO Features

Or download FREE version