-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Add an InputRadio component #5579
Comments
Yes, radio buttons aren't one of the supported input elements yet. This is a good thing to add to the backlog. |
It appears that the issue for the input type of radio is the generated code for the GetValue (100) against 'value'
as opposed to a checkbox with the same binding that generates the GetValue (117) against 'checked'
I gave a shot at understanding the Blazor As far as I can tell all that is needed for radio support is the addition of one line to BindAttributes.cs of
to get the appropriate element of a radio button to get the value of the binding. |
@SteveSandersonMS |
@SteveSandersonMS
I see the first assignment of the radio button in the property but not subsequent changes. I guess this means I need to figure out the caller of |
Hello, what the current situation on this subject I was using this kind of code until now, was worked in preview 3/4, but today i see it not work on preview 5, the checked is not render correctly, but the on change still working
|
Hello, same question to @SteveSandersonMS ... |
Has this been figured out yet? Preview 9 (and therefore RTM) is eminent. |
Radio buttons are not hard to work with in Blazor - I have a gist and Blazor Fiddle that demonstrates this here : https://gist.github.com/SQL-MisterMagoo/bc5713fb26bf84bf810d48d1f45c361a |
Essentially a similar implementation but with an integer backing store:
and the code:
|
In case anyone is interested, here is it for F# and Bolero (which implements a Model-View-Update programming model on top of Blazor): fsbolero/Bolero#75 |
We don't have an InputRadio component itself that works with forms. This is something that could be built, but I suggest filing a separate issue to track it elsewhere instead of here. |
Any news on this yet? I can't get Blazor radio buttons to work with enums and the docs example given does not work? https://docs.microsoft.com/en-us/aspnet/core/blazor/forms-validation?view=aspnetcore-3.1 |
@SteveHindmarsh while binding directly may not work yet, writing a component that generates all the radio buttons from an enum isn't that hard. |
Yes the Blazor paradigm makes things blisteringly simple once you start getting familiar however, if I hadn't wasted time with the incorrect documentation I may have now had exactly that. Anyhow it's allowed me to get familiar with EditContext.OnFieldChanged and the EditContext.NotifyFieldChanged event which has allowed me to program a solution. Blazor rocks! |
I have the the following in my cshtml
with corresponding properties
northwestVacation
andsinaiVacation
in my code. During a debug session I see theget
called numerous times for each but even with atrue
value the corresponding radio button is not in the selected state. And, as I select either button I never see theset
called on either property.The text was updated successfully, but these errors were encountered: