-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
amp-form: pass through non-XHR POST requests #27638
Comments
Yes, we need this very much. At present, it is almost impossible to use existing POST forms on AMP pages. For example, if you have a newsletter form for something like Mailchimp which:
These make such existing form submission endpoints completely incompatible with For awhile now I've been trying to work out a way to let the AMP plugin automatically support such forms by means of a form submission proxy: ampproject/amp-wp#4191. I even made a prototype mini plugin that implements this proxy, which well in the case of form submissions that do a redirect. However, if the form submission endpoint returns HTML (like Mailchimp does) then it is has to try to hack its way to try to scrape the error/success messages from the HTML page to supply into the One other problem that comes up over and over again is that the AMP XHR requests include an All of these headaches would be avoided if AMP would just allow I'm not entirely sure why AMP required XHR for POST forms in the first place. Perhaps it was to encourage developers toward Ajax to create better user experiences? If that's the extent of the rationale, then for the sake of ecosystem compatibility and adoption the XHR requirement for POST forms should be made optional: encouraged yet not required. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
AMP requires XHR to POST a form, but using it will degrade your INP web vitals scores, since on low-end mobile devices it is really slow by design (it initializes the states, templates, etc. on interaction). Now I want to migrate these XHR's back to regular POST methods to avoid the INP issues and it is not allowed... Is there any valid solution? |
amp-form
throws an error if a form withoutaction-xhr
attribute is submitted:amphtml/extensions/amp-form/0.1/amp-form.js
Lines 1062 to 1070 in b6313e3
There might be a situation where a regular (non-XHR) form is rendered on an AMP page – this form will be unsubmittable.
Would it be possible to allow default form submission for non-XHR forms?
The text was updated successfully, but these errors were encountered: