Skip to content

Commit 66876ab

Browse files
authored
fix form reset for records items HTML (#2247)
1 parent c3c3eb8 commit 66876ab

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

pygeoapi/templates/collections/items/index.html

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,30 @@ <h1>{% for l in data['links'] if l.rel == 'collection' %} {{ l['title'] }} {% en
3333
{% if data['itemtype'] == 'record' %}
3434
<div class="row">
3535
<div class="col-sm-12 col-md-6">
36-
<div class="row">
37-
<div class="col-sm-4">
38-
<label for="q">Search</label>
39-
<input name="q" id="q" type="text" class="form-control search-input" placeholder="Search">
40-
</div>
41-
<div class="col-sm-4">
42-
<label for="datetime_begin">Start date</label>
43-
<input name="datetime_begin" id="datetime_begin" type="date" class="form-control" />
44-
</div>
45-
<div class="col-sm-4">
46-
<label for="datetime_end">End date</label>
47-
<input name="datetime_end" id="datetime_end" type="date" class="form-control" />
36+
<form id="searchForm">
37+
<div class="row">
38+
<div class="col-sm-4">
39+
<label for="q">Search</label>
40+
<input name="q" id="q" type="text" class="form-control search-input" placeholder="Search">
41+
</div>
42+
<div class="col-sm-4">
43+
<label for="datetime_begin">Start date</label>
44+
<input name="datetime_begin" id="datetime_begin" type="date" class="form-control" />
45+
</div>
46+
<div class="col-sm-4">
47+
<label for="datetime_end">End date</label>
48+
<input name="datetime_end" id="datetime_end" type="date" class="form-control" />
49+
</div>
4850
</div>
49-
</div>
50-
<div class="row">
51-
<div class="col-sm-12">
52-
<input class="form-check-input" onchange="checkSpatialFilter()" type="checkbox" id="spatial_filter_check">
53-
<label class="form-check-label" for="spatial_filter_check">Spatial filter</label>
54-
<button type="button" class="btn btn-primary" onclick="submitForm();">Search</button>
55-
<button type="reset" class="btn btn-secondary">Reset</button>
51+
<div class="row">
52+
<div class="col-sm-12">
53+
<input class="form-check-input" onchange="checkSpatialFilter()" type="checkbox" id="spatial_filter_check">
54+
<label class="form-check-label" for="spatial_filter_check">Spatial filter</label>
55+
<button type="button" class="btn btn-primary" onclick="submitForm();">Search</button>
56+
<button type="reset" class="btn btn-secondary" onclick="document.getElementById('searchForm').reset();">Reset</button>
57+
</div>
5658
</div>
57-
</div>
59+
</form>
5860
</div>
5961
</div>
6062
{% endif %}
@@ -205,12 +207,12 @@ <h1>{% for l in data['links'] if l.rel == 'collection' %} {{ l['title'] }} {% en
205207
if (q) {
206208
query_string.push('q=' + encodeURIComponent(q));
207209
}
208-
if (datetime_begin) {
210+
if (datetime_begin !== "") {
209211
datetime.push(datetime_begin + 'T00:00:00Z');
210212
} else {
211213
datetime.push('..');
212214
}
213-
if (datetime_end) {
215+
if (datetime_end !== "") {
214216
datetime.push(datetime_end + 'T23:59:59Z');
215217
} else {
216218
datetime.push('..');

0 commit comments

Comments
 (0)