4

Is there a way to format an alphanumeric field to convert all letters in to upper case letters automatically? The entry is for a serial number, which could start with any number or letter, I simply would like the serial number to look like the following: C02MBP46NYE instead of C02mbp46nye.

3

I'm a developer with Cognito Forms.

Yes, you can set the default value of your Text field to a calculation that targets the Text field itself and converts it to uppercase.

In the following example my Text field is labeled 'Text', and the following calculation is added to the default value.

=Text.ToUpper()

Any text entered into the Text field will be converted to upper case. You can learn more about this calculation and other text calculations in our Text Calculations Help Content.

| improve this answer | |
-1

Usin jQuery you could listen for the keyup event and use the js fn toUpperCase().Will be something lke this:

$(document).ready(function(){
$(document).on('keyup', '#your-input', function(){
    var upper = $(this).val().toUpperCase();
    $(this).val(upper)
})
})

An independent approach: With php you could take the input text 'as is' and use the strtoupper() function like this:

<?php 
$text = $_GET['input_text'];
$upper = strtoupper($text);
?>
| improve this answer | |
  • That might be fine for someone who has a custom web app of their own, but that's not happening here. Arbitrary JavaScript can't just be added to a Cognito Form, and I doubt it's built in PHP, much less allow arbitrary code to be added. Even so, this is a site for questions from users; most are not going to be open to a code solution. – ale Feb 27 '17 at 19:40
  • That's right, didn't noticed it, my bad :( – Marange Feb 28 '17 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.