Skip to content
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

Support a template-enabled [submitting] element #9442

Merged
merged 3 commits into from
May 22, 2017

Conversation

cvializ
Copy link
Contributor

@cvializ cvializ commented May 19, 2017

Fixes #8601

} else {
xhrUrl = this.xhrAction_;
body = new FormData(this.form_);
for (const key in opt_extraValues) {
body.append(key, opt_extraValues[key]);
}
values = {};
const entries = body.entries();
Copy link
Contributor

Choose a reason for hiding this comment

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

Iterators are not supported everywhere.

@@ -440,17 +440,20 @@ export class AmpForm {
*/
doXhr_(opt_extraValues) {
const isHeadOrGet = this.method_ == 'GET' || this.method_ == 'HEAD';
const values = this.getFormAsObject_(opt_extraValues);
this.renderTemplate_(values);
Copy link
Contributor

Choose a reason for hiding this comment

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

this will render all templates which causes unnecessary rendering of success/failure templates as well. would be nice if renderTemplate could take the type of target template.

Copy link
Contributor

Choose a reason for hiding this comment

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

It should just render whatever template matches the current form state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Justin's assessment is correct, it only render's the current state's template. In this case it's the FormState_.SUBMITTING state.

Copy link
Contributor

Choose a reason for hiding this comment

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

Great

@@ -564,6 +564,7 @@ amp-iframe iframe {
/**
* Forms error/success messaging containers should be hidden at first.
*/
form [submitting],
Copy link
Contributor

Choose a reason for hiding this comment

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

validator file needs to be changed to support a similar rule to spec_name: "FORM > DIV [submit-success]"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

@aghassemi aghassemi left a comment

Choose a reason for hiding this comment

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

LGTM

@cvializ cvializ merged commit 145a033 into ampproject:master May 22, 2017
@cvializ cvializ deleted the cv-state branch May 22, 2017 17:59
@honeybadgerdontcare
Copy link
Contributor

This is now live in prod.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants