mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
Activate field validation when expanding the advanced options (#722)
This commit is contained in:
parent
4ac580e401
commit
fbed87aa46
@ -29,7 +29,8 @@ var elemIds = {
|
||||
match: 'match-type-select',
|
||||
url: 'search-url',
|
||||
form: 'search-form',
|
||||
resultsNewWindow: 'open-results-new-window'
|
||||
resultsNewWindow: 'open-results-new-window',
|
||||
advancedOptions: 'advanced-options'
|
||||
};
|
||||
|
||||
function makeCheckDateRangeChecker(dtInputId, dtBadNotice) {
|
||||
@ -158,6 +159,13 @@ function performQuery(url) {
|
||||
}
|
||||
}
|
||||
|
||||
function validateFields(form) {
|
||||
if (!didSetWasValidated) {
|
||||
form.classList.add('was-validated');
|
||||
didSetWasValidated = true;
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('[data-toggle="tooltip"]').tooltip({
|
||||
container: 'body',
|
||||
@ -180,12 +188,12 @@ $(document).ready(function() {
|
||||
event.stopPropagation();
|
||||
var url = searchURLInput.value;
|
||||
if (!url) {
|
||||
if (!didSetWasValidated) {
|
||||
form.classList.add('was-validated');
|
||||
didSetWasValidated = true;
|
||||
}
|
||||
validateFields(form);
|
||||
return;
|
||||
}
|
||||
performQuery(url);
|
||||
});
|
||||
document.getElementById(elemIds.advancedOptions).onclick = function() {
|
||||
validateFields(form);
|
||||
}
|
||||
});
|
||||
|
@ -47,7 +47,7 @@ window.wb_prefix = "{{ wb_prefix }}";
|
||||
{% trans %}Search{% endtrans %}
|
||||
</button>
|
||||
<button class="btn btn-outline-info float-right mr-3" type="button" role="button"
|
||||
data-toggle="collapse" data-target="#advancedOptions"
|
||||
data-toggle="collapse" data-target="#advancedOptions" id="advanced-options"
|
||||
aria-expanded="false" aria-controls="advancedOptions" aria-label="Advanced Search Options">
|
||||
{{ _('Advanced Search Options') }}
|
||||
</button>
|
||||
|
Loading…
x
Reference in New Issue
Block a user