How to Extract First and Last Names from a Full Name

WS Form PRO includes powerful variables that let you extract individual components from a full name. You can get the first name, middle name, last name, prefix, and suffix from a single text field without asking users to enter those parts separately. For example, this could be useful if you want to ask the user to enter their first name but want to push name components separately to an integration.

Demo

Variables

In these examples you would replace 123 with the ID of your full name field.

Variable Client-Side Example Action Example (e.g. Field Mapping)
Prefix #text(#name_prefix(#field(123))) #name_prefix(#field(123))
First Name #text(#name_first(#field(123))) #name_first(#field(123))
Middle Name #text(#name_middle(#field(123))) #name_middle(#field(123))
Last Name #text(#name_last(#field(123))) #name_last(#field(123))
Suffix #text(#name_suffix(#field(123))) #name_suffix(#field(123))

These variables will attempt to remove common prefixes and suffixes and return just the clean components.

The #text in the client-side examples ensures the variables are kept up to date automatically as the full name is changed. #text is not needed when using #name_ variables in action settings.

Learn more: Duplicate / Copy Field Values With #text

Use Cases

  • Personalizing Email Templates
    Add the first name to your email subject or greeting using: Hello #name_first(#field(123))
  • Third-Party Integrations
    Map extracted name parts to individual fields in a CRM, email platform, or spreadsheet.
  • Storing Hidden Fields
    You can store these values in hidden fields if you need them for backend use or submission exports.

Notes

  • Only one prefix and one suffix will be returned per name.
  • Middle names can include multiple words (e.g. “Marie Claire”).
  • These variables are case-insensitive and handle common name formats.