Force Uppercase Characters

By: Chris Adams | Asked: 06/18/2021
ForumsCategory: Code SnippetsForce Uppercase Characters
Chris AdamsChris Adams asked 3 years ago
If you need to force a field to convert it’s value to uppercase characters as a user types you can add this JS directly to the [input] shortcode:
[input onkeyup="this.value = this.value.toUpperCase();"]
War Magic replied 3 years ago

If it is possible to convert all fields to uppercase? And I didn't understand exactly where to add?

Chris AdamsFDM Digital replied 3 years ago

To add the code above to any existing fields you need to go to your form Settings > Customise HTML and replace the [input] shortcode for each field with [input onkeyup="this.value = this.value.toUpperCase();"].

It's only intended to be used a few fields though and isn't really practical to do it for every field in the form, especially if it's a long form.

If you wanted to make every field in your form uppercase you'd be better off using jQuery or JS and putting the script in the 'After Content' section of the Customise HTML section.

E.g.

<script>
jQuery(document).on('keyup', '.frm-show-form input[name^="item_meta"], .frm-show-form select[name^="item_meta"], .frm-show-form textarea[name^="item_meta"]', function(){
  jQuery('input[type=text]').val (function () {
    return this.value.toUpperCase();
  })
});
</script>
1 Answers
David Costin answered 2 years ago
What I would like to do is capitalize the first letter when the User enter text into a particular field. David

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