Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forcing form text to be lower-case

How could I force the text in the "username" text input to be lower-case regardless of what user types?

<div class="register">    <label for="username">Select username:</label> </div>  <div class="registerform">     <input name="username" class="registerfont" type="text"            id="username" maxlength="15" style="height:35px; width:300px"> </div> 
like image 551
John Avatar asked Jan 01 '13 00:01

John


People also ask

How do you force lowercase in HTML?

Add text-transform: lowercase; for this field.

How do you write input capital text?

Use keyup() method to trigger the keyup event when user releases the key from keyboard. Use toLocaleUpperCase() method to transform the input to uppercase and again set it to the input element.

How do you change input to lowercase in python?

In Python, lower() is a built-in method used for string handling. The lower() method returns the lowercased string from the given string. It converts all uppercase characters to lowercase. If no uppercase characters exist, it returns the original string.

How do you force uppercase in HTML?

As an aid to form validation we can use HTML5 input patterns to flag when an input is not valid. In the JavaScript examples, the pattern to enforce only uppercase (assuming a single word - no spaces or punctuation) is: <input ... pattern="[A-Z]*" ...>


1 Answers

in CSS:

form input[type="text"] {     text-transform: lowercase; } 

otherwise in JS:

var text="this is my text."; var lowercase=text.toLowerCase(); 
like image 115
fdiv_bug Avatar answered Sep 20 '22 18:09

fdiv_bug