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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Check if Textinputlayout is empty

Thread ID:

Created:

Updated:

Platform:

Replies:

148780 Nov 4,2019 10:52 AM UTC Nov 5,2019 09:24 AM UTC Xamarin.Forms 1
loading
Tags: SfTextInputLayout
Boris Oprit
Asked On November 4, 2019 10:52 AM UTC

Hello,

With a button i send an email , before i send it want to check if the Textinputlayout's are empty .

All fields must be filled before sending the email.

With a normal Entry i check it like this . 
But Textinputlayout not working , cannot be converted to string. What do i change


void OnVerzendButtonClicked(object sender, EventArgs args)
        {
            if ( !string.IsNullOrWhiteSpace(EmailBody.Text) && !string.IsNullOrWhiteSpace(Voornaam.Text) && !string.IsNullOrWhiteSpace(Achternaam.Text))
            {
                EmailSubject.Text = Voornaam.Text + " " + Achternaam.Text;
                var EmailTask = CrossMessaging.Current.EmailMessenger;

                if (EmailTask.CanSendEmail)
                    EmailTask.SendEmail("........@gmail.com", EmailSubject.Text, EmailBody.Text);
            }
            else
            {

               _ = DisplayAlert("Error", "There are some empty fields !", "OK");
            }

       /}



And in Xaml

<inputLayout:SfTextInputLayout x:Name="Voornaam" HelperText="Voornaam" AbsoluteLayout.LayoutBounds=".10,.82,.35,.55" AbsoluteLayout.LayoutFlags="All">
                        <Entry />
                    </inputLayout:SfTextInputLayout>
                    <inputLayout:SfTextInputLayout x:Name="Achternaam" HelperText="Achternaam" AbsoluteLayout.LayoutBounds=".88,.82,.48,.55" AbsoluteLayout.LayoutFlags="All">
                        <Entry />
                    </inputLayout:SfTextInputLayout>

                    <Entry x:Name="EmailSubject" Placeholder="Onderwerp Email" BackgroundColor="White" TextColor="Black"  FontSize="Small" AbsoluteLayout.LayoutBounds="30,330,300,35" AbsoluteLayout.LayoutFlags="None"/>

                    <Editor x:Name="EmailBody" Placeholder="Bericht" BackgroundColor="White" TextColor="Black"  FontSize="Small" AbsoluteLayout.LayoutBounds="30,350,300,15" AbsoluteLayout.LayoutFlags="None" />



Rachel A [Syncfusion]
Replied On November 5, 2019 09:24 AM UTC

Hi Boris, 
 
Greetings from Syncfusion. 
 
To get the entry text which is placed inside text input layout, we can use InputView property as shown in the below code snippet. 
 
[C#] 
string text = (Voornaam.InputView as Entry).Text; 
 
 
Also, you can refer the documentation link to know more information on text input layout. 
 
 
Thanks, 
Rachel. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon