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
813
WebCurrencyEdit converting -ve value to +ve
posted

Hi,

Is there any way (property) in WebCurrencyEdit that if user enters -45 WebCurrencyEdit will convert it to +45 and not 0 if I have put MinValue="0"

I tried with InvalidValue event handler, it sets the value but it is not showing on screen. I mean it if I call obj.setValue(obj.getValue() * -1) which will convert it to +ve it sets the value if I debug and check for getValue() but onscreen it shows $0.00.

I tried with ValueChange event by changing MinValue="-99999..." but then the problem is when I enter -45 1st time it converts it to 45 correctly but if I enter same number -45 again then event id not getting fired and it shows ($45.00) for -ve value.

any suggestions...???

Thanks.

Parents
  • 24497
    Verified Answer
    posted

    Hi Anand,

    If you want to modify value within InvalidValue event, then you should use fields param in handler. It has 3 members: type, text and value.

    If type is 1, then it is invalid range. The text contains current text in editor and value contains suggested new/replacement value. If you do not like that value, then you may set your own and that will be used instead of suggested. Example:

    function WebCurrencyEdit1_InvalidValue(oEdit, fields, oEvent)
    {
     
    var text = fields.text;
     
    if(type == 1 && text && text.charAt(0) == '-')
       fields.value = parseFloat(text.substring(1));
    }

Reply Children
No Data