question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Radio button not updated when using reactive forms

See original GitHub issue

“carbon-components-angular”: “^4.12.1”,

When creating a form with reactive forms the radio button does not get checked when loading that form

The write function of the ControlValueAccessor works as designed but there’s no action to refresh the component to reflect this state

the solution is to update the write function with a refresh of the radios

https://github.com/IBM/carbon-components-angular/blob/a593b9b17e9d525989d746fc6fb087009c8a8b15/src/radio/radio-group.component.ts#L254

changing to

RadioGroup.prototype.writeValue = function (value) {
        this.value = value;
        var _this = this;
        setTimeout(function () {
            _this.updateSelectedRadioFromValue();
            _this.checkSelectedRadio();
        });
    };

let me know if i need to make a pull request for this

thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cal-smithcommented, Aug 24, 2020

I responded to your other issue with the installation issues, so hopefully we can get that sorted! Otherwise, thanks for opening the issue 👍

0reactions
carbon-botcommented, Sep 15, 2020

🎉 This issue has been resolved in version 4.15.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

Radio button not updated when using reactive forms #1464
Today radio module cannot be used in reactive forms , and as i'm migrating from another angular form library i have to stick...
Read more >
pre-selecting material radio button using reactive forms not ...
I'm using Reactive Forms and want to pre-select the first radio button which has a value of 'true'. I initialize the value of...
Read more >
Angular Radio Buttons Reactive Forms Tienanhvn - StackBlitz
Learn to create advance Angular 7 Reactive Forms using ReactiveFormsModule API from scratch with advanced Reactive Forms validation.
Read more >
Angular 14 Radio Buttons Tutorial with Example - positronX.io
Understand how to create Radio Buttons in Angular application using the Template-Driven and Reactive Forms API, individually.
Read more >
Angular Radio Button with Reactive Form Tutorial
If you need to see example of angular radio button group reactive form. In this article, we will implement a how to use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found