My application owners want select text fields to be uppercase as if the caps lock is on. I am using a KnockoutJS viewmodel with observables for these fields. Is there a way I can in effect convert any user entered text to upper case?
I put a input
event on the controls I wanted to change but found that although it works, the observables are not updated.
<input type="text" maxlength="80" data-bind="value: colorName, disable: $parent.isReadOnly, event: { 'input': toUpper }" />
toUpper: function (d, e) {
if (e.target) {
if (e.target.value) {
e.target.value = e.target.value.toUpperCase();
}
}
}
I have also been thinking of putting a ucase
CSS class on the controls I want to be upper case and then either on the client or server, saving those fields in upper case.
.ucase {
text-transform: uppercase;
}