Skip to content

[4.x]: User's Last Name field letter casing lost when saved via front-end form #14723

@vonscriptor

Description

@vonscriptor

What happened?

Description

I've read the past issues dealing with Full/First/Last Names, but am a little unclear on how to handle the following:

Let's take last name "van holtz" as an example. I want it always shown as Van Holtz. However, say another person with the same last name wants it displayed as "van Holtz". Craft's Last Name field seems inconsistent on how it handles this. It lower-cases the "van" when saved via a front-end form, but does maintain casing when saved from the CP. I thought maybe including both in extraLastNamePrefixes might work, but it seems to only go with one.

Note: The Full Name field correctly uses the written case even from a front-end form (even when a "Full Name" field isn't provided and it's generated automatically).

Consideration: Due to how I want to present a user's name on the website I need it to be in 2 parts (first, last) so that I can output and style them individually (I need them on 2 lines).

Steps to reproduce

  1. Set general.php 'showFirstAndLastNameFields' => true,
  2. Create a front-end form that can save a user's Last Name
  3. Save the last name with something like "Van Holtz"

Expected behavior

The letter casing of the last name should be kept when saving from a front-end form like it is in the CP. Whether or not the user wants something like "Van Holtz" or "van Holtz".

Actual behavior

The "Van" in "Van Holtz" is saved as "van Holtz".

Craft CMS version

4.8.6

PHP version

8.1.27

Operating system and version

MacOS Sonoma 14.3.1

Database type and version

MySQL 8.0.30

Image driver and version

No response

Installed plugins and versions

  • Freeform v5.1.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions