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
570
WebCurrencyEdit in whole dollars
posted

I'm using the WebCurrencyEdit control to enter dollar amounts but now need to change them to enter whole dollar amounts only.   The behavior I'd like is that if the user enters an amount with decimals, it gets rounded off to the nearest whole dollar as they leave the field.  I've tried setting the DataMode to Long which prevents any decimal places by ignoring the decimal point.  But I'm concerned with a user entering "123.45" and getting "12,345".  I've also tried setting MinDecimalPlaces to None and manually rounding the value as I read it from the control.  This worked better but it seems the control should be able to handle this.  I've read other posts here that mention the Culture property but I'm not clear how to use that after looking at the forums, documentation and sample apps.  If that is the answer could someone post a simple example?

Thanks.

Parents
No Data
Reply
  • 28407
    Suggested Answer
    posted

    HI,

    Wire up the WebCurrencyEdiors Client-Side ValueChange event

     Here a code snippet to do what you want

    function WebCurrencyEdit1_ValueChange(oEdit, oldValue, oEvent){
     //Add code to handle your event here.
     var val = oEdit.getValue();
     val =  Math.ceil(val);
     oEdit.setValue(val);
     
    }

     

Children
No Data