mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-08-25 13:41:50 +02:00
Support valdiation for form_dat
This commit is contained in:
parent
b205e180f8
commit
500429914e
@ -34,7 +34,7 @@ draft: false
|
|||||||
}
|
}
|
||||||
window.onload = async () => {
|
window.onload = async () => {
|
||||||
window.browser = bowser.getParser(window.navigator.userAgent);
|
window.browser = bowser.getParser(window.navigator.userAgent);
|
||||||
$("input[type='checkbox']:checked").trigger("change")
|
$("input[type='checkbox']").trigger("change")
|
||||||
$("input[type='number'].range").trigger("change")
|
$("input[type='number'].range").trigger("change")
|
||||||
adjustSticky();
|
adjustSticky();
|
||||||
$(window).resize(adjustSticky)
|
$(window).resize(adjustSticky)
|
||||||
@ -184,9 +184,6 @@ draft: false
|
|||||||
if (fillArray.includes(afters.prop("name"))) {
|
if (fillArray.includes(afters.prop("name"))) {
|
||||||
selectSelectAll(afters.first())
|
selectSelectAll(afters.first())
|
||||||
}
|
}
|
||||||
var submit = $(e.target.form).find(':submit')
|
|
||||||
submit.prop("disabled", !isLast)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
async function reloadSelect(name) {
|
async function reloadSelect(name) {
|
||||||
clearSelect(name)
|
clearSelect(name)
|
||||||
@ -573,33 +570,34 @@ draft: false
|
|||||||
data-neednotbrowser='{"OS":["MacOS"]}'>Ctrl</kbd>+<kbd>A</kbd> shortcut key</span>
|
data-neednotbrowser='{"OS":["MacOS"]}'>Ctrl</kbd>+<kbd>A</kbd> shortcut key</span>
|
||||||
</p>
|
</p>
|
||||||
<div style="display: inline-block;">
|
<div style="display: inline-block;">
|
||||||
<label for="DOI_select">Sets</label>
|
<label for="DOI_select" class="required">Sets</label>
|
||||||
<button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button>
|
<button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button>
|
||||||
<select multiple id="DOI_select" name="DOI" onchange="reloadNextSelect(event)"></select>
|
<select multiple id="DOI_select" required name="DOI" onchange="reloadNextSelect(event)"></select>
|
||||||
</div>
|
</div>
|
||||||
<div style="display:inline-block">
|
<div style="display:inline-block">
|
||||||
<label for="mol_select">Molecules</label>
|
<label for="mol_select" class="required">Molecules</label>
|
||||||
<button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button>
|
<button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button>
|
||||||
<select multiple id="mol_select" name="molecule" onchange="reloadNextSelect(event)"></select>
|
<select multiple id="mol_select" required name="molecule" onchange="reloadNextSelect(event)"></select>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div style="display: inline-block;">
|
<div style="display: inline-block;">
|
||||||
<label for="method_select">Methods</label>
|
<label for="method_select" class="required">Methods</label>
|
||||||
<button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button>
|
<button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button>
|
||||||
<select multiple id="method_select" name="method" onchange="reloadNextSelect(event)"></select>
|
<select multiple id="method_select" required name="method" onchange="reloadNextSelect(event)"></select>
|
||||||
</div>
|
</div>
|
||||||
<div style="display: inline-block;">
|
<div style="display: inline-block;">
|
||||||
<label for="basis_select">Basis sets</label>
|
<label for="basis_select" class="required">Basis sets</label>
|
||||||
<button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button>
|
<button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button>
|
||||||
<select multiple id="basis_select" name="basis" onchange="reloadNextSelect(event)"></select>
|
<select multiple id="basis_select" required name="basis" onchange="reloadNextSelect(event)"></select>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Vertical excitation kind</legend>
|
<legend class="required"
|
||||||
|
>Vertical excitation kind</legend>
|
||||||
<p>Choose what kind of vertical excitations you want</p>
|
<p>Choose what kind of vertical excitations you want</p>
|
||||||
<ul class="nestedCbList" style="padding-left: 0em;">
|
<ul class="nestedCbList" style="padding-left: 0em;">
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" checked onchange="nestedCheckbox_change(event)" id="cb_fileType_All"></input>
|
<input type="checkbox" data-onerequired="true" checked onchange="nestedCheckbox_change(event)" id="cb_fileType_All"></input>
|
||||||
<label for="cb_fileType_All"> All</label>
|
<label for="cb_fileType_All"> All</label>
|
||||||
</li>
|
</li>
|
||||||
<ul class="nestedCbList" id="cb_exVertKindList">
|
<ul class="nestedCbList" id="cb_exVertKindList">
|
||||||
@ -615,11 +613,11 @@ draft: false
|
|||||||
</ul>
|
</ul>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset id="excitationFilter">
|
<fieldset id="excitationFilter">
|
||||||
<legend>Filters</legend>
|
<legend class="required">Filters</legend>
|
||||||
<p>Choose other excitation parameters you want</p>
|
<p>Choose other excitation parameters you want</p>
|
||||||
<ul class="nestedCbList" style="padding-left: 0em;">
|
<ul class="nestedCbList" style="padding-left: 0em;">
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" onchange="nestedCheckbox_change(event)" id="cb_exType_All"></input>
|
<input type="checkbox" data-onerequired="true" onchange="nestedCheckbox_change(event)" id="cb_exType_All"></input>
|
||||||
<label for="cb_exType_All"> All</label>
|
<label for="cb_exType_All"> All</label>
|
||||||
</li>
|
</li>
|
||||||
<ul id="cb_exTypeList" class="nestedCbList">
|
<ul id="cb_exTypeList" class="nestedCbList">
|
||||||
@ -640,7 +638,7 @@ draft: false
|
|||||||
onchange="numberRangeChange(event)" max="100" value="100">
|
onchange="numberRangeChange(event)" max="100" value="100">
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<input type="submit" disabled=true value="Load"></input>
|
<input type="submit" value="Load"></input>
|
||||||
</form>
|
</form>
|
||||||
<form id="form_ref">
|
<form id="form_ref">
|
||||||
<fieldset class="main">
|
<fieldset class="main">
|
||||||
|
@ -23,6 +23,10 @@ form label{
|
|||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
}
|
}
|
||||||
|
form legend.required::after,form label.required::after {
|
||||||
|
content: " *";
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
form fieldset.table div {
|
form fieldset.table div {
|
||||||
display: table-row;
|
display: table-row;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ function nestedCheckbox_change(e) {
|
|||||||
ul.children("li").children("input[type=checkbox]").prop("checked", checkbox.is(":checked"));
|
ul.children("li").children("input[type=checkbox]").prop("checked", checkbox.is(":checked"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
nestedCheckbox_refreshMainValidity(checkbox)
|
||||||
//Apply parent
|
//Apply parent
|
||||||
var ul=checkbox.parent("li").parent("ul")
|
var ul=checkbox.parent("li").parent("ul")
|
||||||
var checkbox=$(ul).prev("li").children("input[type=checkbox]")
|
var checkbox=$(ul).prev("li").children("input[type=checkbox]")
|
||||||
@ -21,4 +22,17 @@ function nestedCheckbox_change(e) {
|
|||||||
checkbox.prop("indeterminate",false);
|
checkbox.prop("indeterminate",false);
|
||||||
checkbox.prop("checked",scheckeds[0]);
|
checkbox.prop("checked",scheckeds[0]);
|
||||||
}
|
}
|
||||||
|
nestedCheckbox_refreshMainValidity(checkbox)
|
||||||
|
}
|
||||||
|
function nestedCheckbox_refreshMainValidity(checkbox) {
|
||||||
|
if (checkbox.data("onerequired") && !(checkbox.is(":checked") || checkbox.is(":indeterminate")) ) {
|
||||||
|
checkbox.first().each(function() {
|
||||||
|
this.setCustomValidity("Please check at least one of the checkboxes below")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
checkbox.first().each(function() {
|
||||||
|
this.setCustomValidity("")
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user