Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
265
WebNumericEdit with trailing zeros
posted

The WebNumericEdit works great, except for one issue.

If you enter 12.90, it removes the trailing zero. It becomes 12.9. Is there anyway around this?

I found this bit in the Javscript igedit_number function, which seems to be what's causing the problem:

line 174:

        /* if dot,remove trailing 0s */
        while(i<iL){if(t.charCodeAt(iL-1)!=48)break;t=t.substring(0,--iL);}

 

Thanks

Parents
No Data
Reply
  • 265
    Verified Answer
    posted

    Here's a workaround for anyone interested:

    WebNumericEdit1.ClientSideEvents.Blur = "WebNumericEdit_Blur"

    <script type="text/javascript">
    function WebNumericEdit_Blur(wne, val, e) {
    if (val != null) {
    if (val.match(/[0-9]+\.([1-9](0|$))/))
    wne.minDecimals = 2;
    else
    wne.minDecimals = 0;
    }
    }
    </script>
Children
No Data