Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Graham on Nov 26, 2008 10:20
open dhtmlx forum
dhtmlxcombo validating decimals

I have the following which validates for whole numbers only...

function checkNumbersOnly(val) {
    if (val < 48 || val > 57 ){
         alert('PLEASE NOTE: You can only type numbers in this field');
         z1.setComboText(z1.getComboText().toString().replace(/[^0-9]+/g,""))
     }
}


How do I amend it to validate for numbers with decimals too.  What do I add to prevent it from automatically removing the decimal point every time I enter an illegal character (i.e. a letter)

Thanks,
Graham.

 

Answer posted by Support on Nov 27, 2008 02:49