• Resolved cgorrell

    (@cgorrell)


    I have 2 amp errors but only for two web pages. I have multiple other pages that were not flagged.

    The errors on amp are flagged for a mailchimp form on both pages.

    -The tag ‘FORM [method=POST]’ requires including the ‘amp-form’ extension JavaScript.
    -The mandatory attribute ‘action-xhr’ is missing in tag ‘FORM [method=POST]’.

    Also on: https://travelfinn.com/the-james-finn-podcast-dylan/amp/

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    You’re right. The offending code is coming from the Mailchimp for WordPress plugin. In the non-AMP version of the page, I see the form is defined as:

    <form id="mc4wp-form-1" class="mc4wp-form mc4wp-form-5008" method="post" data-id="5008" data-name="Default sign-up form" >

    There is no action defined here, but the AMP plugin should actually be supplying the current URL for the action when none is defined.

    However, I tried this locally on my dev site and I can’t seem to be able to reproduce the problem.

    In the non-AMP version I do not have an action but in the AMP version, one is supplied. See https://gist.github.com/westonruter/19f45914c550a0f85734e34d62f00b31

    So I’m confused as to why yours is not getting the action-xhr attribute like mine is.

    • This reply was modified 7 years, 2 months ago by Weston Ruter.
    Plugin Author Weston Ruter

    (@westonruter)

    In fact, you can see in the AMP plugin that the current URL is used when no action is present: https://github.com/ampproject/amp-wp/blob/a292772bea3aa6ea0f0103f7e3bad46541ac6866/includes/sanitizers/class-amp-form-sanitizer.php#L73-L78

    Plugin Author Weston Ruter

    (@westonruter)

    Note: One thing that you’ll for sure need to do regardless is ensure that you supply a redirect URL for the form. You can find this in the Mailchimp plugin’s settings screen under “Redirect to URL after successful sign-ups”.

    This is the bare minimum for the form to work in AMP. Other work is needed on that plugin to handle the case of errors being sent back. But this wouldn’t address the problem you see with the action-xhr not being set.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘form error on 2 pages’ is closed to new replies.