Question
Number format not working as expected in Mozzila firefox
Hello All,
As we know that the validation in number field does not work in firefox i.e. it accepts the text characters also. I need to avoid this.Does anyone has the javascript for the same which is working.
Though I tried below as mentioned in one of the post but it is not working either.:
https://community.pega.com/support/support-articles/input-type-number-accepting-text-charachter
UserWorkForm HTML fragment.
<script> pega.u.d.attachOnload(function(){ varnumberElements=document.querySelectorAll(".ie input[type='number']"); debugger; for(vari=0;i<numberElements.length;i++){ numberElements[i].addEventListener('keydown', function(e) { var key = e.keyCode ? e.keyCode : e.which; if (!( [8, 9, 13, 27, 46, 110, 190].indexOf(key) !== -1 || (key == 65 && ( e.ctrlKey || e.metaKey ) ) || (key >= 35 && key <= 40) || (key >= 48 && key <= 57 && !(e.shiftKey || e.altKey)) || (key >= 96 && key <= 105) )) e.preventDefault(); }); }}); </script>
Please help me with the javascript if anyone is having that
Regards,
Debashish Bhowmik
While FF does seem to allow text in the number input type, validation should still catch this before you submit. I just wanted to make sure you were aware of that, in case that was the business concern (storing text in a numeric property type).