Correction erreurs, sécurisation code, personnalisation présentation (Jordan)
This commit is contained in:
parent
717fc5320f
commit
4c71100366
19 changed files with 822 additions and 471 deletions
|
|
@ -45,9 +45,15 @@
|
|||
function changeTypeSaisie(type)
|
||||
{
|
||||
g.toggle(['.type_client', '.type_membre'], false);
|
||||
document.querySelectorAll('.type_client input, .type_client select, .type_client textarea, .type_membre input, .type_membre select, .type_membre textarea').forEach((e) => {
|
||||
e.disabled = true;
|
||||
});
|
||||
|
||||
if (type) {
|
||||
g.toggle('.type_' + type, true);
|
||||
document.querySelectorAll('.type_' + type + ' input, .type_' + type + ' select, .type_' + type + ' textarea').forEach((e) => {
|
||||
e.disabled = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -76,9 +82,11 @@
|
|||
}
|
||||
|
||||
const selclient = document.querySelector('#f_client');
|
||||
selclient.addEventListener("change", () => {
|
||||
modifierContact(selclient, '#f_contact_list', '#f_nom_contact');
|
||||
});
|
||||
if (selclient) {
|
||||
selclient.addEventListener("change", () => {
|
||||
modifierContact(selclient, '#f_contact_list', '#f_nom_contact');
|
||||
});
|
||||
}
|
||||
|
||||
} ());
|
||||
|
||||
|
|
@ -86,12 +94,18 @@
|
|||
// Hide type specific parts of the form
|
||||
function hideAllTypes() {
|
||||
g.toggle('[data-types]', false);
|
||||
document.querySelectorAll('[data-types] input, [data-types] select, [data-types] textarea, [data-types] button').forEach((e) => {
|
||||
e.disabled = true;
|
||||
});
|
||||
}
|
||||
|
||||
// Toggle parts of the form when a type is selected
|
||||
function selectType(v) {
|
||||
hideAllTypes();
|
||||
g.toggle('[data-types~=t' + v + ']', true);
|
||||
document.querySelectorAll('[data-types~=t' + v + '] input, [data-types~=t' + v + '] select, [data-types~=t' + v + '] textarea, [data-types~=t' + v + '] button').forEach((e) => {
|
||||
e.disabled = false;
|
||||
});
|
||||
g.toggle('[data-types=all-but-advanced]', v != 0);
|
||||
// Disable required form elements, or the form won't be able to be submitted
|
||||
$('[data-types=all-but-advanced] input[required]').forEach((e) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue