The amp-form extension allows you to create forms <form> to submit input fields in an AMP document.
Before creating a form, you must include the required script.
<script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script>
It indicates where to display the form response after submitting the form. The value must be _blank or _top.
It specifies a server endpoint to handle the form input. The value must be an https URL (absolute or relative) and must not be a link to a CDN.
The target and action attributes are only used for non-xhr GET requests. When action-xhr is not provided, AMP makes a GET request to the action endpoint and uses target to open a new window (if _blank). The AMP runtime might also fallback to using action and target in cases where the amp-form extension fails to load.
It specifies a server endpoint to handle the form input and submit the form via XMLHttpRequest (XHR). An XHR request (sometimes called an AJAX request) is where the browser would make the request without a full load of the page or opening a new page.
This attribute is required for method=POST, and is optional for method=GET. The value for action-xhr can be the same or a different endpoint than action.
The enctype attribute specifies how form-data should be encoded before sending it to the server via the method=POST submission. The default encoding is set to multipart/form-data.