Difference between revisions of "Changing Text to Uppercase or Lowercase"

From SmartWiki
Jump to: navigation, search
Line 1: Line 1:
 
You can change the case of the text entered in a custom field by writing this code in HTML Tag box in the custom field settings.
 
You can change the case of the text entered in a custom field by writing this code in HTML Tag box in the custom field settings.
  
 +
'''To convert entered text to Uppercase
 +
<pre>
 
  onChange="javascript:this.value=this.value.toUpperCase();"
 
  onChange="javascript:this.value=this.value.toUpperCase();"
 +
</pre>
 +
'''To convert entered text to lowercase
 +
<pre>
 +
onChange="javascript:this.value=this.value.toLowerCase();"
 +
</pre>
  
 
+
The code gets executed as soon as the user enters a value and clicks anywhere outside the field (even without having to hit SAVE).
This code will change the case as soon as the user enters a value and clicks anywhere outside the field (even without having to hit SAVE).
 
  
  
 
[[Category:Custom Fields]][[Category:JavaScript Examples]]
 
[[Category:Custom Fields]][[Category:JavaScript Examples]]

Revision as of 15:20, 23 April 2009

You can change the case of the text entered in a custom field by writing this code in HTML Tag box in the custom field settings.

To convert entered text to Uppercase

 onChange="javascript:this.value=this.value.toUpperCase();"

To convert entered text to lowercase

 onChange="javascript:this.value=this.value.toLowerCase();"

The code gets executed as soon as the user enters a value and clicks anywhere outside the field (even without having to hit SAVE).