Support

Home Forums Event Espresso Premium Default capitalize the first and last name field for questions

Default capitalize the first and last name field for questions

Posted: October 4, 2013 at 2:38 pm


Mike Compton

October 4, 2013 at 2:38 pm

Is there a way to have the questions default or force the first letter as capitalized? I would like to have the first name and last name capitalized for people that are registering.


Sidney Harrell

October 4, 2013 at 3:49 pm

You’ll have to add a little custom javascript (I added it to the registration_page_display.php template, but you can add it to another js that loads on that page, or your own js file and enqueue it)

<script>
	jQuery.fn.capitalize = function() {
    jQuery(this).keyup(function(event) {
        var box = event.target;
        var txt = jQuery(this).val();
        var start = box.selectionStart;
        var end = box.selectionEnd;
        jQuery(this).val(txt.replace(/^(.)|(\s|\-)(.)/g, function($1) {
            return $1.toUpperCase();
        }));
        box.setSelectionRange(start, end);
    });

   return this;
	}
	jQuery(".fname, .lname").capitalize();
</script>

The support post ‘Default capitalize the first and last name field for questions’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso