edit.gohtml 2.0 KB

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