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
95
Prevent Negative Numbers in a numeric textbox
posted

Hi,

I have an igGrid with edit mode dialog. On it, I have a textbox which accepts only numbers. I'm trying to prevent negative numbers from being entered in this field. I tried the below:

settings.ColumnSetting().ColumnKey("test").DefaultValue(0).Required(true).NumericEditorOptions(opt=> {

opt.ValidatorOptions(vopt =>
{
 vopt.ValueRange(0);
});

});

When i run with above and after I enter a correct value, as soon as textbox loses focus, I get an error on infragistics.lob.js.

 Unable to get property 'toString' of undefined or null reference

Please help.

Regards,

Guru

Parents
No Data
Reply
  • 17590
    Offline posted

    Hello Guru,

    Thank you for posting in our community.

    I crated a small sample where I set the valueRange option of numeric editor. On my side everything worked as expected and when a value less than 0 is entered and the editor looses focus validation message appears. Once the value, within the range, is entered the cell value is correctly set without any exception thrown. For my sample I am using latest 18.1 version which is 18.1.152. I tested this under Chrome, Firefox and Edge browser.

    Here you will find my sample. Please run it on your side and let me know what is the result. If this is not an accurate demonstration of your scenario please feel free to modify it and send it back to me for further investigation along with steps to reproduce.

    Looking forward to hearing from you.

Children