-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
Document [SupplyParameterFromForm] attribute #29728
Comments
@MackinnonBuck ... I just took a close look at this subject by reading Javier's issue and their discussion. I think we'd put this work off until after the major Blazor Server/Blazor WebAssembly -- TO -- SSR/CSR changes are made across the docs ... or perhaps just wait until I reach the Forms and Validation article for the SSR/CSR updates and address this issue when I reach the topic. There's even the possibility that we will version out the current Forms and Validation article for <8.0 and write a new >=8.0 forms article because it might be easier to maintain going forward that way. UPDATE: I can't fully experiment until Pre7 lands per dotnet/aspnetcore#47804 with its PR dotnet/aspnetcore#49340. Also, the unopinionated (non- Note to self cross-links Mackinnon mentioned earlier: Blog posts: |
@MackinnonBuck ... If you have a few minutes, I have a ❓ on I may have misinterpreted its use case. I thought that it was to prevent form name collisions ... for example due to a library supplying a form with the same form name as a form in the component that using the library's form. I tried this .......
<EditForm method="post" Model="@this" OnSubmit="@Submit" FormName="Hello">
<InputText @bind-Value="Name" />
<button type="submit">Submit</button>
</EditForm>
@if (submitted)
{
<p>Hello @Name from the library form!</p>
}
@code {
bool submitted = false;
[SupplyParameterFromForm(Handler = "Hello")]
public string? Name { get; set; }
private void Submit() => submitted = true;
} ... and then ...
@page "/named-forms-with-scope"
<h1>Hello form from a library</h1>
<FormMappingScope Name="ParentContext">
<HelloFormFromLibrary />
</FormMappingScope>
<h1>Hello form using the same form name</h1>
<EditForm method="post" Model="@this" OnSubmit="@Submit" FormName="Hello">
<InputText @bind-Value="Name" />
<button type="submit">Submit</button>
</EditForm>
@if (submitted)
{
<p>Hello @Name from the app form!</p>
}
@code {
bool submitted = false;
[SupplyParameterFromForm(Handler = "Hello")]
public string? Name { get; set; }
private void Submit() => submitted = true;
} ... and it doesn't really behave the way I expected ...
Therefore, I think I must have a fundamental misunderstanding of the whole use case. What's the purpose of
|
Thx @MackinnonBuck. In that case, I'll probably go ahead and merge the PR Wednesday with what I understand. We can fix up my draft remarks later. Let me know, @javiercn, if you want me to open a PU issue on the 👽 strange form behavior 👽 with a repro project linked. |
Per #29705 ...
The sample app for the main single-form example is at ...
https://github.com/dotnet/aspnetcore/tree/main/src/Components/Samples/BlazorUnitedApp
Blog post ...
https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-dotnet-8-preview-6/#form-model-binding-validation-with-server-side-rendering
Additional ...
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: