Faq Can i use forms on AMP pages?
Can i use forms on AMP pages?

JAmp can be configured to manage and show certain forms on AMP pages, however AMP forms have several limitations and issues that may prevent the expected behavior of the form, more exactly you have to keep in mind the following requirements:

  • An AMP form can be used ONLY if your site has an SSL certificate running on https, so that the connection is secured
  • An AMP form works only if the 'GET' method is used. If a form that is selected for AMP uses the POST method it will be automatically converted to the GET method by JAmp. This may result to have the form no more working if the server side code expects to receive input data in the POST variables
  • An AMP form cannot contain any input field of type 'password', thus it's not suitable for example for a login form having username/password fields
  • An AMP form cannot contain any input field of type image, file and button
  • An AMP form has no validation and has no javascript code attached to it for special scripts handling

Having said that now you know that an AMP form is suitable to be used only in certain cases, for example for a simple search form, contact form, etc.
To enable the AMP form feature you can turn on the following parameter, by default all forms having the class 'ampform' will be targeted and converted to the AMP format.

If you want to enable all forms at once on your website, such as for example the Joomla! contact form, it's enough to specify a generic 'form' as CSS selector value:

Notice that the default Joomla! contact form is supported and integrated with JAmp in order to be converted to the AMP format and to be fully functional, so if you need to have a contact form on AMP pages you can go on with this without the need of additional resources.

As of now there are extensions to generate dynamic forms such as BreezingForms, Chronoforms, etc that are not compatible with the AMP format. An alternative good extension for the contact form management that has been integrated with JAmp is 'Contact Enhanced', refer to this page for more informations:
JAmp integration with Contact Enhanced

If you have a website with an e-commerce and a shopping cart, you may be tempted to activate AMP even for the e-commerce pages. Although Google doesn't ensure the correct indexing of AMP pages for an e-commerce, product pages usually are perfectly indexed as any common article page. Obviously the full cart and purchase process can't work with an AMP page, however you can reach a compromise by enabling the shopping cart form at least to be visible on an AMP product page.
When a user lands on your AMP product page, he could be able to click the 'Add to cart' button of the form to be redirected to the normal desktop page and go ahead to complete the purchase.
You can see a live example of this configuration opening the JAmp product page and clicking the 'Add to cart' button: https://storejextensions.org/extensions/jamp.amp.html
If the ecommerce component that you are using doesn't work in this way, as an alternative solution you can customize it in order to show a special 'Add to cart' button only on AMP pages that just redirects the user to the regular product page.