Enforcing case constraint on textbox
<p>I have a textbox with the case settings from the database. If the database setting is Upper Case then the textbox text should be converted to Upper Case and if the Setting is Proper Case then the textbox text should be converted to Proper Case. I have achieved this with the help of javascript. </p>

<p>However, I have one more setting which is Upper Changeable where the textbox text is converted to upper case. But if the user does not want upper case he can change the case.</p>

<pre><code> &lt;script type="text/javascript"&gt;
   function toUpper(obj) {
       var mystring = obj.value;
       var sp = mystring.split(' ');
       var wl = 0;
       var f, f1, f2, r1, r2, r;
        if (document.getElementById('&lt;%= hdnNameStyle.ClientID %&gt;').value == "UC") {
         mystring = mystring.toUpperCase();
         obj.value = mystring;
     }
     if (document.getElementById('&lt;%= hdnNameStyle.ClientID %&gt;').value == "PC") {
         var word = new Array();
         for (i = 0; i &lt; sp.length; i++) {
             f = sp[i].substring(0,1).toUpperCase();
             r = sp[i].substring(1);
             word[i] = f + r;
         }
         newstring = word.join(' ');
         obj.value = newstring;
     }
     if (document.getElementById('&lt;%= hdnNameStyle.ClientID %&gt;').value == "UG") {
         mystring = mystring.toUpperCase();
         obj.value = mystring;
     }
  }
</code></pre>

<p></p>

<p>This is the javascript that I have tried and it works fine. However, to clarify it further if the hdnNameStyle value is UG the textbox text is converted to uppercase, but if the user does not want uppercase he can change the case.</p>

<p>How to enable the user to change the case with the help of javascript?</p>

<p>Thanks,</p>
