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

Radio buttons do not get unselected on the same group, with Reactive Forms #9440

Closed
tuchorc opened this issue Oct 22, 2020 · 7 comments
Closed

Comments

@tuchorc
Copy link

tuchorc commented Oct 22, 2020

I'm submitting a ...

[x] bug report

Plunkr Case (Bug Reports)
Using PrimeNG current Template
https://stackblitz.com/edit/github-f2wj15?file=src/app/app.component.html

Current behavior
When using p-radiobutton element with ReactiveFroms, once a radio button gets selected, it never gets unselected. However the form value updates properly.

Expected behavior
Only the current value should be selected on screen

Minimal reproduction of the problem with instructions
Just create a reactive form, with a form control, and a group of radiobuttons. This is a minimal reproduction of the problem, NOT from PrimeNG template on Stackblitz.
https://stackblitz.com/edit/angular-ivy-qc5lgc?file=src%2Fapp%2Fapp.component.html

What is the motivation / use case for changing the behavior?
It doesn't behave as the Template Driven Froms, and as it is expected to behave

  • Angular version:
    Angular 10.2.0

  • PrimeNG version:
    PrimeNG 10.0.3

  • Browser:
    all
    Chrome Version 86.0.4240.80 (Official Build) (x86_64)
    Firefox 81.0.2 (64-bit)
    Safari Version 14.0 (15610.1.28.1.9, 15610)

@jurt
Copy link

jurt commented Oct 23, 2020

I believe this is related to this issue, not sure however why its closed if merge request fixing it titled "Fixed radiobutton with template-driven forms"

@miheyinfo
Copy link

+1

@miguelarcjr
Copy link

I'm also having the same problem.

@karol93
Copy link

karol93 commented Nov 17, 2020

same...

@rafparedis
Copy link

I also have this issue

@jurt
Copy link

jurt commented Nov 17, 2020

Workaround suggested by @keschr in related topic worked for me:

control.valueChanges.subscribe(e => { control.setValue(e, {emitEvent: false}); });

@cagataycivici
Copy link
Member

Please see;

#9162

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

7 participants