We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

SfTextInputLayout possible to hide help text, but always show label

Hi,

is it possible to hide the help text when the text is empty?

Instead

Show

like when it has text
or is edited

When I hide the help text, the label is not displayed.

Regards,

Thomas

5 Replies

BK Bharathiraja K Syncfusion Team March 29, 2019 09:32 AM UTC

Hi Thomas, 
 
Thanks for using the Syncfusion product, 
 
Query 1: is it possible to hide the help text when the text is empty? 
 
Yes, we have achieve your requirement by using the convertor and find the below code snippet. 
 
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 
{ 
            var input = parameter as SfTextInputLayout; 
            input.ShowHelperText = string.IsNullOrEmpty((string)value) ? false : true; 
            return value; 
} 
 
 
Also, we have hide the helper text by using below property. 
 
ShowHelperText="False" 
 
We have prepared the sample based on your requirement and find below. 
 
 
 
 
Regards, 
Bharathi. 



NV nvrsttl March 29, 2019 07:30 PM UTC

Hi Bharathiraj,

thank you for the sample. Unfortunately you misunderstood me. I do not want the Helpertext to hide when the control is empty.

1. When your sample starts (text of the control is empty) the "Hint" is displayed with large fontsize:

2. While editing it changes to a caption with small fontsize:

3. It stays in this small size when text is entered and focus is lost:

What I want to achieve is that, the "hint" is always displayed at the same position and fontsize, whether text is entered or the control is empty
So in case #1 it should look like this:

Hope it gets clearer.

Best regards,

Thomas


BK Bharathiraja K Syncfusion Team April 1, 2019 09:47 AM UTC

Hi Thomas, 
  
Thanks to share the information. 
  
We don’t have direct API to keep the hint at floated position on load time. However, we have achieved it by using a workaround in the application level as shown below code snippet. 
  
Code snippet: 
 
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 
{ 
   return string.IsNullOrEmpty((string)value) ? " " : (string)value; 
} 
  
  
Regards, 
Bharathi. 



NV nvrsttl April 3, 2019 07:49 AM UTC

Hi Bharathi,

thank you for the example. It looks good.

Unfortunately if you enter text in the Entry, it is prefixed with a space. I Trim this text in the model.
I will keep this as the solution, one small point:

Process:
Page is displayed, text of entry is empty => converter adds space and hint is displayed as a caption.


User tabs in the field, and enters text, leading space is trimmed in the model while typing


Later User removes the entered text, converter adds space, hint is still displayed as a caption.

Because focus remains in the entry, user can see the space and removes this also.

If the user now leaves the field it is empty and the hint is displayed with large text again


Maybe there is another workaround to fix this also, however it would be a lot better if there is some native support for this in the control itself, in one of the future versions.

Thank you for your help

Best regards,

Thomas



BK Bharathiraja K Syncfusion Team April 4, 2019 12:13 PM UTC

Hi Thomas, 
 
Currently, we don’t have support to “Fixed floating label”. So, we have logged feature request on this requirement and it will be available in our upcoming volume 2 release at will be planned to roll out at the month of June 2019. You can now track the status of this feature request here. 
 
Feedback Link:  
 
You can now track the status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link. 
 
Regards, 
Bharathi. 


Loader.
Live Chat Icon For mobile
Up arrow icon