Question

3
Replies
29
Views
Close popover
Debashish Bhowmik (DebashishB3013)
Roche

Roche
IN
DebashishB3013 Member since 2019 1 post
Roche
Posted: October 7, 2020
Last activity: October 9, 2020

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

Suggest Edit

Pega Platform User Experience Healthcare and Life Sciences System Administrator