java - Use Hibernate to set value to uppercase -
i need set value being saved db uppercase. environment in java, , i'm using jsp/hmtl/js front end forms.
i have had suggestions modify model's getter/setter believe may dangerous seeing model may used in variety of places, not of may want strictly uppercase value.
previously have tried set value uppercase on web form, using
style="text-transform:uppercase"
however when value saved db retains lowercase value.
is there annotation, or idea has on this?
thanks, dearg
update:
@vimal bera did try this:
$('#xyz').on('input', function() { $('#xyz').val().touppercase(); });
but admit js experience isn't great, needless did not work.
text-transform: uppercase
in css display client text shown uppercase. javascript point of view, text remains lowercase. made test can shown in jsfiddle
the way value input
var textinput = document.getelementbyid("yourinput").value;
before submitting db, should make sure following on textinput
:
var textinput = document.getelementbyid("yourinput").value.touppercase();
edit
instead of .on('input')
, tie javascript <form>
following:
<form action="" onsubmit="dosomethingtoinput();"> function dosomethingtoinput() { document.getelementbyid('ppsn').value.touppercase(); return true // allows form submit }
Comments
Post a Comment