Hi Roger,
Thank you for contacting Syncfusion support.
Please find the responses for your query below,
Query – 1: “Not able to set validation in NumericTextBox”
The NumericTextBox control contains hidden element which contains the value and this hidden element is not validated by default. You need to include the hidden elements in jQuery validation and set “[]” in “ignore” API of “$.validator.setDefaults” to enable validation in NumericTextBox. Please refer to the below code snippet,
<script>
$.validator.setDefaults({
//to validate all fields(hidden also)
ignore: [],
//if we don’t set custom class, default “error” class will be added
errorClass: 'e-validation-error',
//it specifies the error message display position
errorPlacement: function (error, element) {
$(error).insertAfter(element.closest(".e-widget"));
}
});
</script> |
Please find the details regarding this in the documentation link given below,
Query – 2: “On using requiredfieldvalidator control loses format”
We tried the validation using requiredfieldvalidator in NumericTextBox and it was working fine. We could not reproduce the issue from our side. Could you share us more details regarding this issue so that we can help you resolve it.
We have prepared a sample based on the above queries for your reference. Please find it below,
Sample:
Let us know if you have any concerns.
Thanks,
Christo