PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Uppercase First Letter in Form

  1. Okay, let's say someone fills out the form on the site and the use all lowercase letters.

    For example - First name: sean

    Is their a code or script that would automatically make the first letter uppercase no matter if the prospect enters in all lowercase letters?

    For example - First name: sean (However populates as Sean)

    So that when they get an autorespond email it will start with Hello, Sean... vs. Hello, sean..

    Let me know if anyone has conquered this. I have attempted to search however have came up blank.

    Thanks for your help! :)

    Posted 13 years ago on Friday June 11, 2010 | Permalink
  2. PHP has an "upper case" word function ucwords:
    http://php.net/manual/en/function.ucwords.php

    That would be the function to use; I'm not sure where the best place to use it would be (on saving the data or when sending out the autoresponder.)

    Posted 13 years ago on Friday June 11, 2010 | Permalink
  3. You can also easily do this with some jQuery. In this case, simply apply the custom class "capitalize" (via the form admin) to any field you want capitalized. Then, add the following to your page template.

    <script type="text/javascript">
    jQuery.noConflict();
      jQuery(document).ready(function($) {
    
    		$('li.capitalize input').keyup(function(event) {
    		    var textBox = event.target;
    		    var start = textBox.selectionStart;
    		    var end = textBox.selectionEnd;
    		    textBox.value = textBox.value.charAt(0).toUpperCase() + textBox.value.slice(1);
    		    textBox.setSelectionRange(start, end);
    		});
    
      });
    </script>

    I grabbed the snippet from here and it works well in my tests.

    http://stackoverflow.com/questions/2017456/capitalize-first-letter-of-text-field-while-typing-with-jquery

    Posted 13 years ago on Friday June 11, 2010 | Permalink
  4. That works SWEET!

    Thank you ;)

    Posted 13 years ago on Tuesday June 15, 2010 | Permalink

This topic has been resolved and has been closed to new replies.