- Home
- Forum
- ASP.NET Web Forms (Classic)
- Problems when creating NumericTextbox and validations
Problems when creating NumericTextbox and validations
- Mar 11, 2019 05:05 PM UTC
- Mar 13, 2019 12:11 PM UTC
1. The following code does not contain validations and appears without errors.
2. But when you put the validators, it shows that you can not set the ValidationRule property in the Numerictextbox control.
3. Also when I use the requiredfieldvalidator asp, the controls lose format.
4. Finally. I have the scripts in my master page to be able to visualize the validations, this works with the GRID control but with the rest.
SIGN IN To post a reply.
3 Replies
CI
Christopher Issac Sunder K
Syncfusion Team
March 12, 2019 11:01 AM UTC
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,
Documentation: https://help.syncfusion.com/js/validation
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
RA
Roger Alberto
March 12, 2019 01:09 PM UTC
Really, really thanks for your response. Apply the first solution and it worked.
CI
Christopher Issac Sunder K
Syncfusion Team
March 13, 2019 12:11 PM UTC
Hi Roger,
We are glad to hear that the provided solution worked for you. Please let us know if you require any further assistance.
Thanks,
Christo
Christo
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
RA Roger Alberto
- Mar 11, 2019 05:05 PM UTC
- Mar 13, 2019 12:11 PM UTC