Aspnetcore.docs: Please describe how to bind submit button disabled state to validation IsValid

Created on 31 May 2019  Â·  10Comments  Â·  Source: dotnet/AspNetCore.Docs

Given a /Page with an EditForm as shown in these docs, how would one bind the submit button's "disabled" attribute to the current validation status of the form?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Blazor P2 Source - Docs.ms doc-enhancement

Most helpful comment

I couldn't resist commenting on this:

this is an advanced scenario

This is truly a very basic and common scenario!
It's such a simple and common requirement that it definitely should be included in the docs. Scouts honour.

I mean - have you ever seen a form on the interwebs that wont let you click the submit button until all the input is valid? If you haven't I'd be very surprised. If Microsofts cutting edge, premier, shiny new UI framework is truly the stuff of legend it will have a way to cater for this - fairly easily no doubt. I can't see it anywhere though.

All 10 comments

Hello @dazinator ... Check over in engineering. For example, I spotted this one ...

https://github.com/aspnet/Blazor/issues/624

... and there might be others of similar nature. I didn't do an exhaustive search of the issues there.

Let's leave this open for triage. It might be something that DR wants this topic to show.

Thanks. I did have a search but I'll keep hunting and experimenting in the meantime ;-)

Thanks @PeterHimschoot ... that looks very nice.

Engineering will be triaging all of the Blazor.Docs issues soon. I'm adding notes for their pass.

Options:

  • Cross-link to @PeterHimschoot's topic in the Additional resources section.
  • Incorporate something along the lines of @PeterHimschoot "Attempt 2" into the topic.
  • Do nothing ... this is an advanced scenario, and we haven't had further asks for this nor additional :+1: on the issue, which is visible at the bottom of the topic to other readers.

I couldn't resist commenting on this:

this is an advanced scenario

This is truly a very basic and common scenario!
It's such a simple and common requirement that it definitely should be included in the docs. Scouts honour.

I mean - have you ever seen a form on the interwebs that wont let you click the submit button until all the input is valid? If you haven't I'd be very surprised. If Microsofts cutting edge, premier, shiny new UI framework is truly the stuff of legend it will have a way to cater for this - fairly easily no doubt. I can't see it anywhere though.

Some of that is engineering feedback, and I can't remark on it.

As for the rest, it was triaged, so there's no need to push the issue with so much effort. It will be worked, perhaps even this weekend. :rocket:

@mkArtakMSFT You didn't say which way to go with it ...

  • Cross-link to @PeterHimschoot's topic in the Additional resources section.
  • Incorporate something along the lines of @PeterHimschoot "Attempt 2" into the topic.

... or if it's TBD, no worries. I have a nice little pile of issues to work now, so I'm good.

@javiercn can you recommend the best option here?

@javiercn I'm up to working this. Just need to know if the topic should incorporate something along the lines of @PeterHimschoot "Attempt 2" into the topic to resolve this issue ...

https://blogs.u2u.be/peter/post/disabling-the-submit-button-in-blazor-with-validation

... or do you just want me to cross-link his whole blog post in the Additional Resources section of the topic?

@SteveSandersonMS Is probably a better person to recommend an option in this area.

@SteveSandersonMS ~Quick ? for this issue that I hope to resolve today ...~

~For enabling/disabling the submit button based on validation, do you find the approach in @PeterHimschoot's Attempt 2 (blog post) acceptable for the Forms and Validation topic? If so, I'll put something along those lines up.~

Nevermind ... I'm going to go ahead with a similar approach (this issue is next on my list). DR can look at it on the PR and may ping later on review.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

neman picture neman  Â·  3Comments

Raghumu picture Raghumu  Â·  3Comments

AnthonyMastrean picture AnthonyMastrean  Â·  3Comments

fabich picture fabich  Â·  3Comments

sonichanxiao picture sonichanxiao  Â·  3Comments