edit.gohtml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. {{define "edit.html"}}
  2. <h1>EDIT</h1>
  3. {% extends 'layout.html' %}
  4. {{ block "content" . }}
  5. <form action="/contacts/{{ .contact.ID }}/edit" method="post">
  6. <fieldset>
  7. <legend>Contact Values</legend>
  8. <div class="table rows">
  9. <p>
  10. <label for="email">Email</label>
  11. <input name="email" id="email" type="email"
  12. hx-get="/contacts/{{ .contact.ID }}/email" hx-target="next .error"
  13. hx-trigger="change, keyup delay:200ms"
  14. placeholder="Email" value="{{ .contact.Email }}">
  15. <span class="error">{{/* {{ .contact.Errors.email }} */}}</span>
  16. </p>
  17. <p>
  18. <label for="first_name">First Name</label>
  19. <input name="first_name" id="first_name" type="text" placeholder="First Name"
  20. value="{{ .contact.First }}">
  21. {{/* <span class="error">{{ .contact.Errors.first }}</span>*/}}
  22. </p>
  23. <p>
  24. <label for="last_name">Last Name</label>
  25. <input name="last_name" id="last_name" type="text" placeholder="Last Name"
  26. value="{{ .contact.Last }}">
  27. {{/* <span class="error">{{ .contact.Errors.last }}</span>*/}}
  28. </p>
  29. <p>
  30. <label for="phone">Phone</label>
  31. <input name="phone" id="phone" type="text" placeholder="Phone" value="{{ .contact.Phone }}">
  32. {{/* <span class="error">{{ .contact.Errors.phone }}</span>*/}}
  33. </p>
  34. </div>
  35. <button>Save</button>
  36. </fieldset>
  37. </form>
  38. <button id="delete-btn"
  39. hx-delete="/contacts/{{ .contact.ID }}"
  40. hx-push-url="true"
  41. hx-confirm="Are you sure you want to delete this contact?"
  42. hx-target="body">
  43. Delete Contact
  44. </button>
  45. <p>
  46. <a href="/contacts">Back</a>
  47. </p>
  48. {{ end }}
  49. {{end}}