-
Notifications
You must be signed in to change notification settings - Fork 19
proof of concept demo with iron-form #12
base: master
Are you sure you want to change the base?
Conversation
], | ||
|
||
_validate:function () { | ||
_validateAttrs: function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling this _validate
is confusing once support for form validation logic is added so I propose renaming it. Let me know if something else (maybe that doesn't even have the word validate in it -- maybe checkOptions
?) would be better.
_getValidity: function () { | ||
this.toggleClass('invalid', this._invalid); | ||
return !this._invalid; | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wonder why you call toggle class in _getValidity method ?
a google-recaptcha element's _getValidity
method now gets called when you submit an iron-form that contains it. Without this toggleClass
call, the red border would not appear around an invalid recaptcha upon attempting to submit the form.
What about set pristine to false in _responseHandler and _expiredHandler. It can make sense to have visual rendering even if you havn't click on the submit button. |
I think you should remove class="foo" from template tag :) |
This is a first pass at demonstrating putting a required google-recaptcha element inside an iron-form. To accomplish this, I gave the google-recaptcha element the
Polymer.IronFormElementBehavior
andPolymer.IronValidatableBehavior
behaviors and supporting logic.This may more properly belong in a separate element just for iron-forms (e.g.
iron-form-recaptcha
) if you'd like to keepgoogle-recaptcha
agnostic to the form implementation it's included in, but it seems there should be a generic way for thegoogle-recaptcha
element to advertise its validity state to any containing form implementations. Polymer developers please advise, and I will be happy to help with taking this from proof of concept to whatever you envision offering.