Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

material:TextField RequiredValidation validator not working #349

Open
wasyster opened this issue Apr 27, 2023 · 0 comments
Open

material:TextField RequiredValidation validator not working #349

wasyster opened this issue Apr 27, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@wasyster
Copy link

I have a simple test app, to test the validation:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:uranium="http://schemas.enisn-projects.io/dotnet/maui/uraniumui"
             xmlns:material="http://schemas.enisn-projects.io/dotnet/maui/uraniumui/material"
             xmlns:validation="clr-namespace:InputKit.Shared.Validations;assembly=InputKit.Maui"
             xmlns:validationRules="clr-namespace:TastAppForUraniumUI.Validators"
             xmlns:v="clr-namespace:UraniumUI.Validations;assembly=UraniumUI.Validations.DataAnnotations"
             xmlns:input="clr-namespace:InputKit.Shared.Controls;assembly=InputKit.Maui"
             xmlns:fa="clr-namespace:UraniumUI.Icons.FontAwesome;assembly=UraniumUI.Icons.FontAwesome"
             xmlns:materialIcons="clr-namespace:UraniumUI.Icons.MaterialIcons;assembly=UraniumUI.Icons.MaterialIcons"
             xmlns:viewModel="clr-namespace:TastAppForUraniumUI"
             x:DataType="viewModel:MainPageViewModel"
             x:Class="TastAppForUraniumUI.MainPage"
             xmlns:local="clr-namespace:TastAppForUraniumUI">
    <VerticalStackLayout>
        <material:TextField Text="{Binding Name}" Title="Name"
                            Icon="{FontImageSource FontFamily=MaterialRegular, Glyph={x:Static materialIcons:MaterialRegular.Person}}">
            <material:TextField.Validations>
                <validation:RequiredValidation Message="Please fill this field" />
            </material:TextField.Validations>
        </material:TextField>
        <material:TextField Text="{Binding Email}" Title="E-mail"
                            Icon="{FontImageSource FontFamily=MaterialRegular, Glyph={x:Static materialIcons:MaterialRegular.Email}}">
            <validation:RequiredValidation />
            <validation:RegexValidation Pattern="{x:Static input:AdvancedEntry.REGEX_EMAIL}" Message="Invalid email address" />
        </material:TextField>

        <input:FormView>
            <input:AdvancedEntry Title="Type your email below"
                                 IconImage="{FontImageSource FontFamily=MaterialRegular, Glyph={x:Static materialIcons:MaterialRegular.Email}, Color={StaticResource Primary}}">
                <input:AdvancedEntry.Validations>
                    <validation:RequiredValidation />
                    <validation:RegexValidation Pattern="{x:Static input:AdvancedEntry.REGEX_EMAIL}" Message="Invalid email address" />
                </input:AdvancedEntry.Validations>
            </input:AdvancedEntry>
            <Button Text="Submit" input:FormView.IsSubmitButton="True" />
        </input:FormView>
    </VerticalStackLayout>
</ContentPage>

On the AdvancedEntry the required validation is working, but the the TextField it's not. I even tried to write my own not empty validator, and that wasn't working too. When I debug my validator, I saw that on key down (typing new chars) it detected the changes, but when I use backspace no event was triggered.

@enisn enisn added the bug Something isn't working label Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants