There are times that users do not pay attention to capitalizing the letters when typing form fields.
Problem
- Sometimes we are sending leads to Zoho or other CRM. Sometimes form submitters aren't properly capitalizing their first and last names. They will write things like "john smith" or "JOHN SMITH" or "john Smith." but the proper way is "John Smith"
- When a client wants to send an email campaign, it would be sent to "Hi JOHN" or similar which looks not professional even though it is not a problem from our client side as names are written by the submitters.
So, to fix this issue…
Solution
I found a way to correct this at the source (in Gravity Forms) using a bit of PHP. (Thanks for Scott bringing up this problem 🤟)
Simply add the following lines to your existing function in Script Organizer:
// update "9" to your form ID and "20" to the Field ID
add_filter( 'gform_get_input_value_9_20', function( $value ) { return ucwords(strtolower( $value )); } );
Result
If the submitter fills the name / last name in this form “JOHN SMITH”, “john Smith” or similar the data would be recorded like “John Smith” in gravity form.