SfTextInputLayout: How to set HasError on exit

Is there a way to set the HasError property of the SfTextInputLayout control on exit based on the child Entry control having a text.length of 0?

Also the same question with a child SfComboBox control having no selection?

Thank you in advance.
Judi Smith

1 Reply 1 reply marked as answer

SS Sridevi Sivakumar Syncfusion Team December 31, 2020 12:27 PM UTC

Hi Judi Smith,


Greetings from Syncfusion.


QueryIs there a way to set the HasError property of the SfTextInputLayout control on exit based on the child Entry control having a text.length of 0.
Yes, if text length goes to 0, we can change the HasError value in entry TextChanged evnt.

[C#]  
        private void Entry_TextChanged(object sender, TextChangedEventArgs e)  
        {  
           textinput.HasError = (e.NewTextValue.Length == 0) ? true : false;  
        }  
 

Query: Set the HasError property when SfComboBox control having no selection
We have modified the HasError property in the SComboBox SelectionChanged event when the count of selected items is 0 in the SfComboBox .

[C#]  
        private void SfComboBox_SelectionChanged(object sender, Syncfusion.XForms.ComboBox.SelectionChangedEventArgs e)  
        {  
            textinput2.HasError = ((comboBox.SelectedItem as ObservableCollection<object>).Count == 0) ? true : false;  
        }  
 

We have prepared a simple sample based on your requirement, please have a sample from the below link
https://www.syncfusion.com/downloads/support/forum/161058/ze/LayoutSample912984687


Let us know if you need any further assistance.


Regards,
Sridevi S  
  
 


Marked as answer
Loader.
Up arrow icon