What\'s the best way to enforce require
check on paper-radio-group
? I saw another question and answer that uses fallback-selection
, here,
I'm assuming you call checkAnswers()
in your submit
handler. Note that validate()
on children that have the IronFormElementBehavior
and the required
attribute. If you apply required
to the appropriate input elements, you could replace checkAnswers()
with this.$.form.validate()
.
submit: function() {
//var isValid = checkAnswers();
var isValid = this.$.form.validate();
}
actually does not have the IronFormElementBehavior
, so its required
attribute has no effect. You could workaround this by wrapping
with your own custom element that properly adds the behavior:
Then, just replace
with
:
Yes
No
codepen
For binary input like these Yes/No answers, it might be appropriate to use
instead, as it requires less code and simplifies the form for that input.
codepen