I wanted to add validation for the below code such that:
var metR = $(this).val();
var regex = /((\d+)(\.\d{1}))$/;
if (metR != '') {
if (!regex.test(metR)) {
var itemRow = "<ul id='listError'><li>" + "The Proposed Meter Reading is Invalid" + " " + "</li></ul>";
FUNMessageBox(itemRow, "E", 700, 200, "", "");
rv = false;
return false;
}
}
Currently it is validating like: 123.0(Valid) 46466.7(Valid) When user enters, 123 .0 or 123. 0 it is taking the value.
123 .0 (invalid)
123. 0 (invalid) when user enter spaces between digits,message should appear as "The reading is invalid"