Event OnBlur and SFtextBox name

Hy everyone,


in order to manage the validation of my fields, I use the "OnBlur" method.

 <div class="row">

                    <div class="col-12 text-start">

                        <SfTextBox Placeholder="EMail" FloatLabelType="FloatLabelType.Always" ID="EMail" @bind-Value="@login!.EMail" Blur="@ValidateUser"></SfTextBox>

                        <ValidationMessage For="@(() => login.EMail)" />

                    </div>

                </div>

                <div class="row">

                    <div class="col-12 mt-2 text-start">

                        <SfTextBox Placeholder="Mot de passe" FloatLabelType="FloatLabelType.Always" ID="Password" @bind-Value="@login!.Password" Type="InputType.Password" Blur="@ValidateUser"></SfTextBox>

                        <ValidationMessage For="@(() => login.Password)" />

                    </div>

                </div>

I thought that with the "Args" I could have the name of the control but I can't find it :(

private async Task ValidateUser(FocusOutEventArgs args)

    {


    }


Can you help me ?


Thx

Geff


2 Replies

UD UdhayaKumar Duraisamy Syncfusion Team December 5, 2022 04:34 PM UTC

You can pass the additional parameters to the event as in below code snippet.


@using Syncfusion.Blazor.Inputs

 

<div class="row">

    <div class="col-12 text-start">

        <SfTextBox Placeholder="EMail" FloatLabelType="FloatLabelType.Always" ID="EMail" @bind-Value="@EMail" Blur=@((args)=>ValidateUser(args,"Email"))></SfTextBox>

    </div>

</div>

<div class="row">

    <div class="col-12 mt-2 text-start">

        <SfTextBox Placeholder="Mot de passe" FloatLabelType="FloatLabelType.Always" ID="Password" @bind-Value="@Password" Type="InputType.Password" Blur=@((args)=>ValidateUser(args,"Password"))></SfTextBox>

    </div>

</div>

 

@code {

 

    public string EMail { get; set; } = "Syncfusion";

    public string Password { get; set; } = "Password";

 

    private async Task ValidateUser(FocusOutEventArgs args, string id)

    {

 

    }

}



GE Geoffrey December 5, 2022 05:15 PM UTC

Perfect, it was so simple! 


thx.

Geff


Loader.
Up arrow icon