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

CslaValidation component needs to implement IValidationMessageStore #3918

Open
rockfordlhotka opened this issue May 6, 2024 · 2 comments
Open

Comments

@rockfordlhotka
Copy link
Member

In a Blazor EditForm you can use the CslaValidator and CslaValidationMessages components like this:

    <EditForm Model="@Person" OnSubmit="Save">
        <CslaValidator />
        <ValidationSummary />

        <InputText @bind-Value="Person.Name" />
        <CslaValidationMessages For="() => Person.Name" />
        <button type="submit">Save</button>
    </EditForm>

This should cause validation messages to appear when the user tabs out of the InputText control with a broken rule,

It doesn't work properly right now, because CslaValidator doesn't implement the IValidationMessageStore interface (at least according to Copilot).

@Freelancingonupwork
Copy link
Contributor

Hello, you mean custom IValidationMessageStore interface?

@rockfordlhotka
Copy link
Member Author

Hello, you mean custom IValidationMessageStore interface?

I am not 100% sure.

Right now, if you implement an EditForm over a type that uses DataAnnotations attributes and use the standard data annotations validator in the EditForm, you can see how the form works at runtime.

If you implement an EditForm over a type that uses CSLA business rules that do the same thing (like the Required rule), and use the CSLA validator in the EditForm, you can see how that form works at runtime.

The two don't work quite the same in terms of when the broken rule results appear to the user.

My guess is that something is missing in the CslaValidator implementation to get the same behavior - and my thought is that the behavior should be the same (or as close as possible).

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

No branches or pull requests

2 participants