Megabit / Blazorise

Blazorise is a component library built on top of Blazor with support for CSS frameworks like Bootstrap, Tailwind, Bulma, AntDesign, and Material.
https://blazorise.com/
Other
3.18k stars 517 forks source link

Calculate input name attribute in SSR mode #5593

Closed stsrki closed 5 days ago

stsrki commented 6 days ago

Closes #5592

At first, I tried using FieldIdentifier, but we had several problems.

  1. FieldIdentifier is only available on Validations. I tried to bring it down to input level, but it was too complex and it broke the validation. We can reconsider this for 2.0 as I have realized we had to break some APIs also.
  2. The FieldIdentifier was generating invalid names, eg. FieldName instead of Model.FieldName.

So, I went and saw how they do it in .NET core. I have copied their helpers, who are internal only and brought them to Blazorise. Then, I used some of the code to generate the name attribute. simplified it, and made it to work with our components. It works as expected.

One problem, though. On our Radio component, we already have the Name parameter. I still need to see what to do with it.

I still want to see if there is only room for improvement. This is only a first run.


@mrpmorris Any chance you could test it?