AMP
  • email

Conference Survey Email

Introduction

This sample demonstrates how to build an AMP-powered email that contains a simple interactive survey.

The main content of the email, an image and a short description of the event.

It’s been a busy few days at the latest AMP conference. We hope you had a good time!

<amp-img class="m1"
  width="600"
  height="314"
  layout="responsive"
  src="https://amp.dev/static/img/sharing/default-600x314.png"></amp-img>
<p>It’s been a busy few days at the latest AMP conference. We hope you had a good time!</p>

To make the survey, we use an amp-form with radio button input fields.

The second step of the form, free text input, is hidden initially and gets displayed after the user selects a rating, as this triggers a change event.

When the form is submitted, we display a short confirmation message to the user by using <div submit-success>.

How would you rate this year's conference?

Thank you for submitting feedback.
<form method="post"
  action-xhr="https://amp.dev/documentation/examples/api/submit-form-input-text-xhr">
  <div class="m1">
    <p>How would you rate this year's conference?</p>

    <input type="radio"
      id="rating1"
      name="rating"
      value="3"
      on="change:step2.show"
      required>
    <label for="rating1">Great</label>

    <input type="radio"
      id="rating2"
      name="rating"
      value="2"
      on="change:step2.show">
    <label for="rating2">Not bad</label>

    <input type="radio"
      id="rating3"
      name="rating"
      value="1"
      on="change:step2.show">
    <label for="rating3">Meh</label>
  </div>
  <div class="m1"
    id="step2"
    hidden>
    <label class="block"
      for="info">Would you like to tell us more?</label>
    <textarea class="block"
      id="info"
      name="name"
      rows="5"></textarea>
  </div>
  <input type="submit"
    value="Send feedback">
  <input type="reset"
    value="Clear">

  <div class="m1"
    submit-success>
    Thank you for submitting feedback.
  </div>
</form>
자세한 설명이 필요하신가요?

이 페이지의 설명만으로 궁금한 점이 모두 해결되지 않는다면 다른 AMP 사용자에게 문의하여 구체적인 활용 사례를 논의해 보세요.

Stack Overflow로 이동
설명이 부족한 기능을 발견하셨나요?

AMP 프로젝트는 여러분의 참여와 기여를 적극 환영합니다! 오픈 소스 커뮤니티를 통해 지속적으로 활동해 주셔도 좋지만 관심 있는 주제에 한 번만 기여하셔도 큰 도움이 됩니다.

GitHub에서 샘플 수정하기