# Change UPPERCASE entries to Capitalized upon submission?

**URL:** <https://community.gravityforms.com/t/change-uppercase-entries-to-capitalized-upon-submission/9840>\
**Category:** Get Help\
**Tags:** ucwords\
**Created:** [June 15, 2021, 7:57pm UTC](https://community.gravityforms.com/t/change-uppercase-entries-to-capitalized-upon-submission/9840 "2021-06-15T19:57:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![crucesignati](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/crucesignati/32/2755_2.png) [@crucesignati](https://community.gravityforms.com/u/crucesignati)\
**Post date:** [June 15, 2021, 7:57pm UTC](https://community.gravityforms.com/t/change-uppercase-entries-to-capitalized-upon-submission/9840/1 "2021-06-15T19:57:25Z")

</div>

Trying to find a way to change case of submitted entries from uppercase to capitalized. I’ve seen some snippets here that can successfully change all or selected entries to uppercase, but none that can take uppercase entries and convert to capitalized.

I’ve found CSS can be used to convert lowercase entries to capitalized or uppercase or vice versa, but haven’t had any luck changing uppercase entries to capitalized.

The issue: client has mostly foreign students applying via GF. In some countries, apparently filling out entire form in uppercase is standard, but this makes using submitted data cumbersome as they have to retype entries when used in merges.

Any advice appreciated.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [June 15, 2021, 8:31pm UTC](https://community.gravityforms.com/t/change-uppercase-entries-to-capitalized-upon-submission/9840/2 "2021-06-15T20:31:05Z")

</div>

Hello. You can use one of those snippets with the PHP `ucwords` function:

[https://www.php.net/manual/en/function.ucwords.php](https://www.php.net/manual/en/function.ucwords.php)

For example, this filter would work with `ucwords` vs `strtoupper`:

> **[gform\_save\_field\_value - Gravity Forms Documentation](https://docs.gravityforms.com/gform_save_field_value/#4-uppercase-value)**
>
> Use this filter to change the field's value before saving it to the database. Use in conjunction with gform\_get\_input\_value to perform low level transformations, such as encrypting/decrypting a field.

---

<div class="post-metadata">

**Author:** ![crucesignati](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/crucesignati/32/2755_2.png) [@crucesignati](https://community.gravityforms.com/u/crucesignati)\
**Post date:** [June 16, 2021, 7:31pm UTC](https://community.gravityforms.com/t/change-uppercase-entries-to-capitalized-upon-submission/9840/3 "2021-06-16T19:31:20Z")

</div>

Thank you Chris. From those resources, I was able to cobble together something that works on text, name, and address field types.

```auto
add_filter( 'gform_save_field_value', 'uppercase_text', 10, 3 );
function uppercase_text( $value, $entry, $field ) {
	$t=$field->get_input_type() ;
    if ( ($t == 'text') || ($t == 'name') || ($t == 'address')) {
        $value = ucwords(strtolower($value),"^ \t\r\n\f\v");
    }
    return $value;
}

```

Researching now how to apply to list fields as well. Any recommendations?

Again - many thanks!

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [June 17, 2021, 7:36pm UTC](https://community.gravityforms.com/t/change-uppercase-entries-to-capitalized-upon-submission/9840/4 "2021-06-17T19:36:06Z")

</div>

Hello. I think I would use the built in logging in Gravity Forms to see what the $entry and $value look like, so you can see how to access them. First, enable Gravity Forms logging:

> **[Logging and Debugging - Gravity Forms Documentation](https://docs.gravityforms.com/logging-and-debugging/#enabling-logging)**
>
> For quite a while, enabling logging within Gravity Forms has been a go-to method for debugging any issues within Gravity Forms. As of Gravity Forms version 2.2, logging functionality has been moved from a separate add-on to becoming a core feature of...

Then add a logging statement to your uppercase\_text function so that you can see what the $value and the $entry look like.

You can add these lines to your existing function, right before the `$t=` line:

```auto
GFCommon::log_debug( __METHOD__. '(): ENTRY => ' . print_r( $entry, true ) );
GFCommon::log_debug( __METHOD__. '(): VALUE => ' . print_r( $value, true ) );

```

That is going to log the entry a bunch of times which is redundant, but it will show you the entry.

Let us know what you find out.

---

<div class="post-metadata">

**Author:** ![crucesignati](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/crucesignati/32/2755_2.png) [@crucesignati](https://community.gravityforms.com/u/crucesignati)\
**Post date:** [June 18, 2021, 4:55pm UTC](https://community.gravityforms.com/t/change-uppercase-entries-to-capitalized-upon-submission/9840/5 "2021-06-18T16:55:49Z")

</div>

That’s a great idea. Thank you. Will report back. Cheers!

---

<div class="post-metadata">

**Author:** ![richardw8k](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/richardw8k/32/2354_2.png) [@richardw8k](https://community.gravityforms.com/u/richardw8k)\
**Post date:** [January 5, 2022, 8:32am UTC](https://community.gravityforms.com/t/change-uppercase-entries-to-capitalized-upon-submission/9840/6 "2022-01-05T08:32:10Z")

</div>


