I have a website in asp.net and I am working on creating AMP pages at http://mywebsite.com/amp/......
I was able to make all the necessary changes for AMP except the following error.
The attribute 'action' may not appear in tag 'FORM [method=POST]'
the Form tag in my website looks like this
<form name="form1" method="post" id="form1">
AMP tutorial suggest to use action-xhr=/default.aspx
instead of action="default.aspx
here is the source: https://ampbyexample.com/components/amp-form/
Now, the thing is how to remove action attribute and add action-xhr
attribute in asp.net.
I tried following code in cs file but no luck.
this.Page.Form.Attributes.Remove("action");
Please note JavaScript
and jQuery
are not allowed in AMP
Add this script in the head tag (this will make your
form
to amp-form):Now, your form can have
action-xhr
attribute.and