Skip to content
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

Bug Report: radio or radiogroup not showing first radio as selected. #3247

Open
dormitionskete opened this issue Mar 21, 2025 · 0 comments
Open

Comments

@dormitionskete
Copy link

There appears to be a bug in ZK Framework 10.0.0-jakarta with the radio or radiogroup component. And it appears to be present in 9.6.0.2 as well.

When you place two or more radio components in a radiogroup, and set the first component to either checked="true" or selected="true", when you view the form, the radio button does not appear to be checked.

If you wire it to a pojo, and query it, it will say the button is checked or selected. It doesn't matter whether you use checked or selected. Neither seems to work properly.

Even if you setChecked("true") or setSelected("true") programatically, it will not display as if it is checked / selected.

But if you set the second radio component to checked or selected, it will show properly.

I suspect it has something to do with the radiogroup index property.

A workaround to this is to create an invisible radio as the first item of the radiogroup. And it does not even need to be wired, as long as it is set to that same radiogroup.

In the example below, I put both checked="true" and selected="true" in it, but it works fine this way with just one of them, and it does not matter which one we use.

Example:

<radiogroup id="testRadiogroup" />
<vlayout>
    <radio id="radioInvisible" label="Invisible. This is necessary for the default radio button to show selected." radiogroup="testRadiogroup" visible="false" />
    <radio id="radio1" label="Radio 1." radiogroup="testRadiogroup" checked="true" selected="true" />
    <radio id="radio2" label="Radio 2." radiogroup="testRadiogroup"/>
</vlayout>

If this is not the correct place to file a bug report for this, please direct me to the proper place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant