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

The tag 'FORM [method=GET]' requires including the 'amp-form' extension JavaScript. #802

Closed
abrambailey opened this issue Nov 8, 2017 · 5 comments
Milestone

Comments

@abrambailey
Copy link

abrambailey commented Nov 8, 2017

I'm seeing this error being generated on my site.

The tag 'FORM [method=GET]' requires including the 'amp-form' extension JavaScript.

This is from the generated amp html:

<form action="[removed]" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate=""> </form>
@westonruter
Copy link
Member

Where is the form coming from? Is it in the post content or is it somewhere else? Is it coming from a shortcode?

@abrambailey
Copy link
Author

abrambailey commented Nov 12, 2017

This comes from the following raw html on a page.

  <form action="[removed]" class="validate" id="mc-embedded-subscribe-form" method="post" name="mc-embedded-subscribe-form" novalidate="" target="_blank">
    <div class="input-group" id="mc_embed_signup_scroll">
      <input class="email form-control" id="mce-EMAIL" name="EMAIL" placeholder="email address" required="" type="email" value="">
      <div>
        <input name="[removed]" tabindex="-1" type="text" value="">
      </div>
      <span class="input-group-btn">
        <input class="button btn btn-info" id="mc-embedded-subscribe" name="subscribe" type="submit" value="Subscribe">
      </span>
    </div>
  </form>

@abrambailey
Copy link
Author

@westonruter Is there a class name that I can apply to this form's containing div to have it ignored for the amp version? Like class="hide_in_amp" or something?

@brianlayman
Copy link

For now, you could add the amp-form extension through a function hooked to the action 'amp_post_template_head', checking for that specific page.

@westonruter
Copy link
Member

For forms that are added to to the v0.6 paired mode templates, adding the amp-form component script needs to be done via the amp_post_template_data filter as can be seen being done for analytics:

https://github.com/Automattic/amp-wp/blob/216ec376ab5bc698e03a149e6e68fa771cffd2d0/includes/amp-post-template-actions.php#L20

https://github.com/Automattic/amp-wp/blob/216ec376ab5bc698e03a149e6e68fa771cffd2d0/includes/amp-post-template-actions.php#L120-L131

Otherwise, for forms that are added to the content or for forms that are added to templates in themes that have amp support (new in 0.7-alpha in develop), then merely adding a <form> to the response will cause the AMP component script to automatically be included.

See #907 and #875.

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

No branches or pull requests

3 participants