How to display first name in email from name field?

By: Tom Boltwood | Asked: 02/10/2023
ForumsCategory: General questionsHow to display first name in email from name field?
Tom BoltwoodTom Boltwood asked 1 year ago
I have created a form with a name field and I wish to address the email to the person who's filled in the form. If I use the name field, in this case [6] it uses the whole name. Is there a way to access just the first name?
3 Answers
Best Answer
Michael ClarkMichael Clark answered 1 year ago
Hi,   If you're using the field [6] in an email and/or in a message displayed after the form is submitted, you can use:    
[6 show="first"]
    Hope this helps! :) 
Rob LeVineRob LeVine replied 1 year ago

Ugh, that's too simple. I like my overly complex solution better 🙂

Michael ClarkMichael Clark replied 1 year ago

So do I, tbh. But you should still upvote mine. I'm angling for the "No-Code Hacker Mittens" from the schwag store. 😛

Rob LeVineRob LeVine replied 1 year ago

Done. May the Schwag be with you.

Tom BoltwoodTom Boltwood replied 1 year ago

Perfect, exactly what I was hoping would be the answer. Strange that it's not in the documentation.

Tom BoltwoodTom Boltwood replied 1 year ago

So it is, just not where I expected it to be! I was looking in the email notification docs.

Bobby Clapp answered 1 year ago
Michael ClarkMichael Clark replied 1 year ago

I'm thinking the field Tom's referring to is the Name field in the Form Builder.

[6 show="first"] Will do the trick in email actions and submission confirmation messages. Maybe in Views, too. 🙂

Rob LeVineRob LeVine answered 1 year ago
I've been frustrated by this as well and have always used two fields for first and last. Beyond that there are a couple of ways I can think of for you to handle your issue. You can either set up two hidden fields for the first and last and add jQuery to split the name into those fields and when the form is saved, you have the fields separate. You can create a custom shortcode to split a string into two pieces and, wherever you use [6], you change it to [my-shortcode name="[6]"]. The problem with both of these solutions is that if the person enters a middle name or initial or a suffix or prefix to their name, the splitting is not going to work.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right