Skip to content

[Blazor] Enhance form and data-permanent is not enough control. #54117

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

Closed
1 task done
Bartmax opened this issue Feb 19, 2024 · 4 comments
Closed
1 task done

[Blazor] Enhance form and data-permanent is not enough control. #54117

Bartmax opened this issue Feb 19, 2024 · 4 comments
Labels
area-blazor Includes: Blazor, Razor Components

Comments

@Bartmax
Copy link

Bartmax commented Feb 19, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

Right now, we can have data-permanent tags on many places of a webpage so when we submit a form o do some enhance nav those elements doesn't get diffed and works ok 👍

But what I find most interesting, when using forms, is that I want to be able to "only" diff inside a element and it's parents and care less for the rest of the page, so insted of doing data-permanent on every piece of dom i need to keep, i would like to specify a piece of dom i want to only get updated.

This also enables the scenario that you can keep parent elements while updating child elements (currently not posible)

Examples:

<div class="modal">
  <EditForm data-enhance=true> ... </EditForm>
</div>

In this example, the modal is shown via some javascript so it updates to:

<div class="modal open">
  <EditForm data-enhance=true> ... </EditForm>
</div>

after submit, the modal closes (because the open class is not persisted).
If I add <div class="modal" data-permanent=true> then the form is not updated with validation errors.

Describe the solution you'd like

What I would like in my scenario, is a way to specify which parts to update.

<div class="modal">
  <EditForm data-enhance="{some identifier}"> ... </EditForm>
</div>

Where some identifier could be an element id, a component, or whatever, for example:

<div class="modal">
  <div id="UpdateThisAndChildsOnPost">
    <EditForm data-enhance="UpdateThisAndChildsOnPost"> ... </EditForm>
  </div>
</div>

Additional context

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Feb 19, 2024
@javiercn
Copy link
Member

@Bartmax thanks for contacting us.

This is a different model than the one Blazor uses for enhanced navigation (more like update panel or the old MVC AJAX functionality) and for the time being we don't have plans to implement that type of feature.

Is there a reason why updating the entire page doesn't work?

@javiercn javiercn added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Feb 20, 2024
@Bartmax
Copy link
Author

Bartmax commented Feb 20, 2024

As I said, it's not possible to keep parent elements with data permanent (in my sample, the modal open), while updating the inner form with validation.

As soon as you put data-permament on an element, all childs updates are ignored.

So any update via js to any parent of a part that needs to update wont be able to use data-permament.

@dotnet-policy-service dotnet-policy-service bot added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Feb 20, 2024
@mkArtakMSFT mkArtakMSFT removed the Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. label Feb 20, 2024
@mkArtakMSFT
Copy link
Member

Thanks for contacting us.
While this may be a great idea, it is not aligned with our long-term vision to make it part of the framework. For many other ideas which don't belong to the framework we encourage the community to build and ship on their own, contributing to the expanding .NET Ecosystem.

You can learn more about our triage process and how we handle issues by reading our Triage Process writeup.

@mkArtakMSFT mkArtakMSFT closed this as not planned Won't fix, can't repro, duplicate, stale Feb 20, 2024
@Bartmax
Copy link
Author

Bartmax commented Feb 20, 2024

So you don't encourage users to use interaction via JavaScript, only wasm or blazor server. Noted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

No branches or pull requests

4 participants
@Bartmax @javiercn @mkArtakMSFT and others