Data validation

Hi,

I'm trying to understand how the valition works when using SfTextBox with IDataValidation.
I've implemented the control as the documentation says, but i'm not seing a way to manually trigger the validation, before attempting form submission.


Best,
Bruno



4 Replies

SS Sridevi Sivakumar Syncfusion Team July 17, 2018 03:53 AM UTC

Hi Bruno,

Thank you for using Syncfusion products.

The IDataValidation interface in the SfTextBoxExt has two API’s Error and this[string columnname]. The “this[string columnname]“ is used to get the instance of the control added the application and the “Error” API is used to return the error msg which we can return if we need to have a common log for all the instance of the control and can use the other for having specific error logs for each instance. It is recommended to use the this[string columnname] to have the validation of the control which you have currently using.

we have achieved your requirement using textchanged event.Please find sample from given below

Sample Link:
http://www.syncfusion.com/downloads/support/forum/138705/ze/Sample-423760758  
Please check the sample if it meets your requirement and let us know if you have any concern.
Regards,
Sridevi S.
 



BP Bruno Pires July 17, 2018 08:30 AM UTC

Hi,

Appreciate the reply, but the link is for a sample for autocomplete, and has no validation in place.
Regarding your comment, do you mean i should use the textchanged event to trigger the validation manually? If so, can you tell me witch API to call to trigger the validation?


Best,
Bruno


BP Bruno Pires July 17, 2018 10:07 AM UTC

Hi again,

So i found out why the validation wasn't being triggered, if the binding is done with the x:bind instead of binding keyword, the validation isn't triggered.
So, now if get the texbox border red when the validtion fails, but not error message, is it the suposed to be like that?


Thanks,
Bruno


SS Sridevi Sivakumar Syncfusion Team July 19, 2018 12:51 PM UTC

Hi  Bruno,

We would like to inform you that IDataValiation will not trigger any validation popup or message by itself before form submission. It will validate the Text of SfTextBoxExt control based on the validation condition and set the HasError attached property in DataValidation class. Using this property you can show/hide the validation error message in your application. We have prepared a sample for the same. You can download the sample from following link:

Sample Link:
http://www.syncfusion.com/downloads/support/forum/138705/ze/AutoUWP-1763708155  
Regards
Sridevi S.
 


Loader.
Up arrow icon