Skip to content

Instantly share code, notes, and snippets.

@andreban
Last active January 10, 2018 16:01
Show Gist options
  • Select an option

  • Save andreban/3359ca500968d1316015780d8aa464fb to your computer and use it in GitHub Desktop.

Select an option

Save andreban/3359ca500968d1316015780d8aa464fb to your computer and use it in GitHub Desktop.
<!doctype html>
<html ⚡>
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script>
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.1.js"></script>
<link rel="canonical" href="./amp-form-sub.html">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<title>amp-form with variable substitution</title>
</head>
<body>
<h1>amp-form with variable substitution</h1>
<form method="POST" action-xhr="/server" target="_top">
<input type="text" name="name">
<!-- This will add the value query parameter 'test' to the 'test' hidden field -->
<input type="hidden" name="test" value="QUERY_PARAM(test)" data-amp-replace="QUERY_PARAM">
<input type="submit" value="OK">
<div submit-success>
<template type="amp-mustache">
Success! Thanks for trying the <code>amp-form</code> demo!
</template>
</div>
<div submit-error>
<template type="amp-mustache">
Error!
</template>
</div>
</form>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment