File size: 2,340 Bytes
ba95c2e
 
 
 
 
 
 
 
a4a1065
 
 
 
94f054c
 
 
ba95c2e
 
 
 
94f054c
 
 
ba95c2e
 
 
 
94f054c
 
 
ba95c2e
 
 
 
94f054c
 
 
ba95c2e
 
 
 
d666b46
 
 
 
 
 
 
 
 
 
 
 
 
 
ba95c2e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{% extends "layout.html" %}

{% block content %}
    <form action="/contacts/{{contact.id}}/edit" method="post">
        <fieldset>
            <legend>Contact Values</legend>
            <p>
                <label for="email">Email</label>
                <input name="email" id="email" type="email"
                hx-get="'/contacts/{{contact.id}}/email"
                hx-target="next .error"
                placeholder="Email" value="{{contact.email or ''}}">
                {% if contact.errors.email %}
                <span class="error">{{ contact.errors.email}}</span>
                {% endif %}
            </p>
            <p>
                <label for="firstname">First Name</label>
                <input name="firstname" id="firstname" type="text" placeholder="First Name" value="{{contact.firstname or ''}}">
                {% if contact.errors.firstname %}
                <span class="error">{{ contact.errors.firstname}}</span>
                {% endif %}
            </p>
            <p>
                <label for="lastname">Last Name</label>
                <input name="lastname" id="lastname" type="text" placeholder="Last Name" value="{{contact.lastname or ''}}">
                {% if contact.errors.lastname %}
                <span class="error">{{ contact.errors.lastname}}</span>
                {% endif %}
            </p>
            <p>
                <label for="phone">Phone</label>
                <input name="phone" id="lastname" type="Phone" placeholder="Phone" value="{{contact.phone or ''}}">
                {% if contact.errors.phone %}
                <span class="error">{{ contact.errors.phone}}</span>
                {% endif %}
            </p>
            <input type="submit" value="Save"/>
        </fieldset>
    </form>
    <noscript>
        <form action="/contacts/{{contact.id}}/delete" method="post">
            <input type="submit" value="Delete"/>
        </form>
        <p>
            <a href="/contacts" role="button">Back</a>
        </p>
    </noscript>
    <div role="group">
        <button hx-get="/contacts" hx-target="body" hx-push-url="true">Back</button>
        <button hx-delete="/contacts/{{contact.id}}" hx-target="body" hx-push-url="true" 
        hx-confirm="Are you sure you want to delete this contact?">Delete</button>
    </div>
    
{% endblock %}