-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
Validate radio button group not individual inputs. #271
Comments
I just noticed that if I have the focus on the Yes but not checked then move to the right using the cursor key I don't get this behavior. |
If you want to validate on blur it would work better using Then you'd raise the blur event when the yes-no component loses focus, not when parts of the yes-no component lose focus. |
How? What if I did not have a yes-no component? How do I blur on components? |
if you need to validate on blur, and the component that represents your property is made up of two radio inputs, the best thing to do is go ahead and create that yes-no component. Then you can fire blur when your component loses focus and everything will work as you'd expect. |
Can you show in code rather than words? I'm having a hard time wrapping my brain around how to take a group of HTML inputs and know when I leave one those inputs that I'm leaving the component instead of leaving the one of the inputs to another within the component. How would I write the code or what would the code look like that says you have left the component now when to fire a 'blur' event? |
for the record, #271 (comment) worked for me as follows: <template bindable="value">
<label repeat.for="opt of [['Yes', true], ['No', false]]">
<input type="radio" name="foo" model.bind="opt[1]" checked.bind="value"/>${opt[0]}
</label>
</template> <template>
<require from="components/yes-no.html"></require>
Do you agree?<br/>
<yes-no value.two-way="result & validate"></yes-no> Binding is working but blur validation is not happening. |
@jdanyow could you please clarify how to fire the 'blur' event? |
ah, looks like #297 is supposed to answer this. Currently, it only links to a solution when the custom element has one focusable element. |
I was able to get it to work by using validateOnChange. yay! |
If I do the following there is a blip on the validation.
I can understand why my question is can this be fixed and if so how?
The text was updated successfully, but these errors were encountered: