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

InputSelect not clearing message #10

Closed
douglassimaodev opened this issue Jan 22, 2020 · 2 comments
Closed

InputSelect not clearing message #10

douglassimaodev opened this issue Jan 22, 2020 · 2 comments

Comments

@douglassimaodev
Copy link

Id is a Guid so "select one" has a default Guid

                                        <InputSelect class="form-control" @bind-Value="Id">
                                            <option value="0000.0000.0000.0000.0000">Select One</option>
                                            @foreach (var item in items)
                                            {
                                                <option value="@item.Id">@item.Description</option>
                                            }
                                        </InputSelect>

                                        <ValidationMessage For="@(() => Id)" />
                                    </div>

RuleFor(x => x.PresenterIdentificationId).NotEqual(new Guid());
RuleFor(x => x.PresenterIdentificationId).NotEmpty();

the error message only disappears when button save is clicked where InputText removes error message after type and losing focus

@ryanelian
Copy link
Owner

ryanelian commented Jan 22, 2020

IIRC Blazor does not support non-string Select Value, so this is NOT the problem of FluentValidation.Blazor library but Blazor itself.

Let me redirect your complaint to this thread: dotnet/aspnetcore#9939

@douglassimaodev
Copy link
Author

yah sorry about that... did a workaround

public string IdString { get; set; }

public Guid Id
{
get { return Guid.TryParse(IdString , out Guid g) ? g : default; }
set { IdString = Convert.ToString(value); }
}

InputSelect class="form-control" @bind-Value="IdString ">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants