fix: Make the IPR search form work when enter is pressed (#4114)
This commit is contained in:
parent
c2fb5e5b66
commit
cfa0886343
|
@ -1,8 +1,8 @@
|
|||
$(document)
|
||||
.ready(function () {
|
||||
// hack the "All States" check box
|
||||
$("#id_state")
|
||||
.addClass("list-inline");
|
||||
$("#id_state .form-check")
|
||||
.addClass("form-check-inline");
|
||||
|
||||
$("#id_state input[value!=all]")
|
||||
.on("change", function (e) {
|
||||
|
@ -20,18 +20,24 @@ $(document)
|
|||
}
|
||||
});
|
||||
|
||||
// make enter presses submit through the nearby button
|
||||
// FIXME: this seems to be broken
|
||||
$("form.ipr-search input,select")
|
||||
.on("keyup", function (e) {
|
||||
var submitButton = $(this)
|
||||
.closest(".mb-3")
|
||||
.find('button[type=submit]');
|
||||
if (e.which == 13 && submitButton.length > 0) {
|
||||
submitButton.trigger("click");
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
$("form.ipr-search button[type=submit]")
|
||||
.on("click", function (e) {
|
||||
const value = $(e.target)
|
||||
.attr("value");
|
||||
$("form.ipr-search input[name=submit]")
|
||||
.attr("value", value);
|
||||
});
|
||||
});
|
||||
|
||||
// make enter presses submit through the nearby button
|
||||
$("form.ipr-search input")
|
||||
.on("keydown", function (e) {
|
||||
if (e.key != "Enter") {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
$(this)
|
||||
.closest(".input-group")
|
||||
.find('button[type=submit]')
|
||||
.trigger("click");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
{% bootstrap_label form.draft.label label_for=form.draft.id_for_label label_class="form-label" %}
|
||||
<div class="input-group">
|
||||
{% render_field form.draft class="form-control" placeholder="draft-..." %}
|
||||
<button class="btn btn-primary" type="submit" name="submit" value="draft">
|
||||
<button class="btn btn-primary" type="submit" value="draft">
|
||||
<i class="bi bi-search"></i> Search
|
||||
</button>
|
||||
</div>
|
||||
|
@ -22,7 +22,7 @@
|
|||
{% bootstrap_label form.rfc.label label_for=form.rfc.id_for_label label_class="form-label" %}
|
||||
<div class="input-group">
|
||||
{% render_field form.rfc class="form-control" placeholder="123..." %}
|
||||
<button class="btn btn-primary" type="submit" name="submit" value="rfc">
|
||||
<button class="btn btn-primary" type="submit" value="rfc">
|
||||
<i class="bi bi-search"></i> Search
|
||||
</button>
|
||||
</div>
|
||||
|
@ -31,7 +31,7 @@
|
|||
{% bootstrap_label form.doctitle.label|cut:":" label_for=form.doctitle.id_for_label label_class="form-label" %}
|
||||
<div class="input-group">
|
||||
{% render_field form.doctitle class="form-control" placeholder="protocol..." %}
|
||||
<button class="btn btn-primary" type="submit" name="submit" value="doctitle">
|
||||
<button class="btn btn-primary" type="submit" value="doctitle">
|
||||
<i class="bi bi-search"></i> Search
|
||||
</button>
|
||||
</div>
|
||||
|
@ -42,7 +42,6 @@
|
|||
{% render_field form.group class="form-select" %}
|
||||
<button class="btn btn-primary btn-block"
|
||||
type="submit"
|
||||
name="submit"
|
||||
value="group">
|
||||
<i class="bi bi-search"></i> Search
|
||||
</button>
|
||||
|
@ -53,7 +52,7 @@
|
|||
{% bootstrap_label form.holder.label|cut:":" label_for=form.holder.id_for_label label_class="form-label" %}
|
||||
<div class="input-group">
|
||||
{% render_field form.holder class="form-control" placeholder="John Doe..." %}
|
||||
<button class="btn btn-primary" type="submit" name="submit" value="holder">
|
||||
<button class="btn btn-primary" type="submit" value="holder">
|
||||
<i class="bi bi-search"></i> Search
|
||||
</button>
|
||||
</div>
|
||||
|
@ -62,7 +61,7 @@
|
|||
{% bootstrap_label form.iprtitle.label|cut:":" label_for=form.iprtitle.id_for_label label_class="form-label" %}
|
||||
<div class="input-group">
|
||||
{% render_field form.iprtitle class="form-control" placeholder="protocol..." %}
|
||||
<button class="btn btn-primary" type="submit" name="submit" value="iprtitle">
|
||||
<button class="btn btn-primary" type="submit" value="iprtitle">
|
||||
<i class="bi bi-search"></i> Search
|
||||
</button>
|
||||
</div>
|
||||
|
@ -71,7 +70,7 @@
|
|||
{% bootstrap_label form.patent.label|cut:":" label_for=form.patent.id_for_label label_class="form-label" %}
|
||||
<div class="input-group">
|
||||
{% render_field form.patent class="form-control" %}
|
||||
<button class="btn btn-primary" type="submit" name="submit" value="patent">
|
||||
<button class="btn btn-primary" type="submit" value="patent">
|
||||
<i class="bi bi-search"></i> Search
|
||||
</button>
|
||||
</div>
|
||||
|
@ -81,6 +80,7 @@
|
|||
please enter the entire string, or as much of it as possible.
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="submit">
|
||||
</form>
|
||||
<p class="alert alert-info my-3">
|
||||
The material posted as IPR disclosures should be viewed as originating
|
||||
|
|
Loading…
Reference in a new issue