Components: [md-radio] required attribute doesn't work for md-radio-group or md-radio-button

Created on 31 Oct 2016  路  4Comments  路  Source: angular/components

Bug, feature request, or proposal:

bug, (or feature request)

What is the expected behavior?

required attribute is available in md-radio-group or md-radio-button,
i.e., when a user clicks submit button in a form without selecting any required radio options,
the form should tell the user that (s)he needs to select one of those.

refs. w3c description about "input required"
https://www.w3.org/TR/html5/forms.html#attr-input-required

What is the current behavior?

required attribute is ignored without any errors or warnings.

What are the steps to reproduce?

Visit the following plunker page:
http://plnkr.co/edit/6Y2L1cLwYX2TOXv5UDOu?p=preview

In the plunker, we have 2 forms, one with naive html5 radio buttons and the other with md-radio-group and md-radio-buttons.
In the upper form, we cannot 'save' without selecting any options,
but in the lower one, it seems we can 'save' without selecting anything.

What is the use-case or motivation for changing an existing behavior?

Client side validation same as md-input or naive input type='radio'.

Which versions of Angular, Material, OS, browsers are affected?

angular: 2.0.2
material: 2.0.0-alpha.9-3
os: OSX El Capitan 10.11.6
browser: Google Chrome 54.0.2840.71 (64-bit)

Is there anything else we should know?

P3 help wanted

Most helpful comment

@jelbourn @kara Hello, do we intend to fix this. I started to work on this by adding the required property on the md-radio-group and automatically updating the required attribute on the md-radio-button. Is that ok? Should I create the PR?
thanks

All 4 comments

@jelbourn @kara Hello, do we intend to fix this. I started to work on this by adding the required property on the md-radio-group and automatically updating the required attribute on the md-radio-button. Is that ok? Should I create the PR?
thanks

is this still untouched? i'm very interested in that pr

@emreavsar looks like @krigton put together a PR (https://github.com/angular/material2/pull/1690) that was approved but stalled for a few months and closed

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vanor89 picture vanor89  路  3Comments

jelbourn picture jelbourn  路  3Comments

vitaly-t picture vitaly-t  路  3Comments

theunreal picture theunreal  路  3Comments

savaryt picture savaryt  路  3Comments