1. Home
  2. Developer
  3. Developing on Matador Jobs
  4. Splitting the application form name
  1. Home
  2. Developer
  3. Code Snippets
  4. Splitting the application form name

Splitting the application form name

By default, we have a single name field in our form for the applicant name. This singe field is then split into first, middle and last (and pro/postfix) by code after submitting the application form.

If you need to show separate inputs for each element then you need to adjust the fields shown via the filter “matador_application_fields_defaults”.

This example is using the complex field name “first_and_last_name” (see below for options).

function matador_docs_matador_application_fields( $fields ) {
	// remove the default name field
	unset($fields['name']);

	return [ 'first_and_last_name'] + $fields;
}

add_action( 'matador_application_fields_defaults', 'matador_docs_matador_application_fields' );

You will also need to add the new name to the required fields.

function matador_docs_matador_default_required_fields( $fields ) {
	$fields[] = 'first_and_last_name';

	return $fields;
}

add_action( 'matador_default_required_fields', 'matador_docs_matador_default_required_fields' );

The following values are supported as name field options.

  • complex_name – ‘namePrefix’, ‘firstName’, ‘middleName’, ‘lastName’, ‘nameSuffix’
  • first_middle_last_name – ‘firstName’, ‘middleName’, ‘lastName’
  • first_and_last_name – ‘firstName’, ‘lastName’
  • namePrefix
  • firstName
  • middleName
  • lastName
  • nameSuffix
Updated on September 24, 2023
Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support