Add to the uppercase command in forms

hi friends, i have to add to the uppercase command in HTML forms. In HTML forms when we enter the name of the user it has to change in caps. Your answer will be appreciated.

thank you :):slight_smile:

Welcome to the SP forums. That sounds like a javascript question to me, so I’ve moved your question to that forum.

Language decisions! :slight_smile:

With javascript you can use the toUpperCase() function:

<p>Your name: <input id="name" type="text" onkeyup="capitalize()"></p>
<script type="text/javascript">
function capitalize(){
   var name=document.getElementById('name').value;

As long as the visitor has javascript enabled, the input of the form appears as uppercase on screen, and will be send to the form-handler page as “hard coded capitals”.

If you only need the capitals on screen, you can use css instead:

#name2 {
   text-transform: uppercase;
<p>Your name: <input id="name2" type="text"></p>

If you want the capitals in your database, even if javascript is disabled, then you can use the php-function [U]strtoupper()[/U] [in the receiving php-page]. - This can be combined with the css method for the form page.

It is simpler in situations like this to allow the person to enter the value in mixed case and convert to uppercase on the server after the form is sublitted. You need to do that anyway in case JavaScript is turned off.

thanks for helping me