How to restrict numbers after the decimal points in the input box ?
Hi karthi K ,
This was a demo link for your reference: Click here
use this javascript
document.getElementById($parameters.Inputid).addEventListener('input', function (e) { let value = e.target.value; if (value === '') return; const regex = /^\d*\.?\d{0,2}$/; if (!regex.test(value)) { e.target.value = e.target.getAttribute('data-last-valid') || ''; } else { e.target.setAttribute('data-last-valid', value); }});
Refer the OML.
Hello Karthi,
You can use an Input Mask to do that.
There are several Forge components that you can explore, for example, this one:
https://www.outsystems.com/forge/component-overview/7838/input-mask-react-o11
Kind regards,
Rui Barradas
Hi @karthi K,
Good Day!!!
Can you please elaborate your requirement?Do you want the input box to not have decimal values at all or do you want to restrict the number of digits after the decimal point?
Thanks,Vignesh Prakash.
restrict the number after the decimal point? sir
Thanks for the clarification @karthi K sir, The solution from @Srigovindh-EONE above should do the trick, Please try and let us know if you face any issue with the implementation.