Difference between revisions of "Changing Text to Uppercase or Lowercase"
From SmartWiki
Eric Lauer (talk | contribs) |
|||
(2 intermediate revisions by one other user not shown) | |||
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 | + | '''To convert entered text to Uppercase |
− | + | ||
− | onChange=" | + | onChange="this.value=this.value.toUpperCase();" |
− | + | ||
− | '''To convert entered text to lowercase | + | '''To convert entered text to lowercase |
− | + | ||
− | onChange=" | + | onChange="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). | The code gets executed 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 | + | You can also use onBlur instead of onChange |
+ | |||
+ | onblur="this.value=this.value.toUpperCase()" | ||
+ | |||
+ | * onBlur runs when the focus moves away from the current field | ||
+ | * onChange runs when the content of the field has changed | ||
+ | |||
+ | [[Category:Custom Fields]][[Category:JavaScript]] |
Latest revision as of 10:34, 29 April 2022
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="this.value=this.value.toUpperCase();"
To convert entered text to lowercase
onChange="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).
You can also use onBlur instead of onChange
onblur="this.value=this.value.toUpperCase()"
- onBlur runs when the focus moves away from the current field
- onChange runs when the content of the field has changed