Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

proof of concept demo with iron-form #12

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

jab
Copy link

@jab jab commented Oct 4, 2015

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 and Polymer.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 keep google-recaptcha agnostic to the form implementation it's included in, but it seems there should be a generic way for the google-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.

],

_validate:function () {
_validateAttrs: function () {
Copy link
Author

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;
},
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cbalit wrote:

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.

@cbalit
Copy link

cbalit commented Oct 8, 2015

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.

@cbalit
Copy link

cbalit commented Oct 8, 2015

I think you should remove class="foo" from template tag :)

@jab jab mentioned this pull request Oct 19, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants