dert
This commit is contained in:
parent
25ca470e70
commit
33a7436eda
|
|
@ -47857,19 +47857,29 @@ function formAjoutTableRef() {
|
|||
|
||||
// 4. Focus intelligent sur le PREMIER champ du formulaire
|
||||
setTimeout(function() {
|
||||
// Sélecteur optimisé ESI : exclut hidden, disabled et readonly
|
||||
var $firstField = $('#div_maj_table')
|
||||
.find('input:not([type="hidden"]):not([disabled]):not([readonly]):visible, select:not([disabled]):not([readonly]):visible')
|
||||
.first();
|
||||
// 1. Définition du sélecteur d'exclusion
|
||||
// On cible : input (sauf hidden), select, textarea
|
||||
// On exclut : :disabled, [readonly], :hidden
|
||||
var selector = 'input:not([type="hidden"]):not(:disabled):not([readonly]):visible, ' +
|
||||
'select:not(:disabled):not([readonly]):visible, ' +
|
||||
'textarea:not(:disabled):not([readonly]):visible';
|
||||
|
||||
// 2. Recherche du premier élément valide dans le conteneur
|
||||
var $firstField = $('#div_maj_table').find(selector).first();
|
||||
|
||||
// 3. Application du focus avec vérification
|
||||
if ($firstField.length > 0) {
|
||||
if ($firstField.hasClass('selectpicker')) {
|
||||
// Pour Selectpicker, on utilise sa méthode interne
|
||||
$firstField.selectpicker('focus');
|
||||
} else {
|
||||
// Pour les autres (input, textarea, select standard)
|
||||
$firstField.focus();
|
||||
}
|
||||
} else {
|
||||
console.log("Aucun champ saisissable trouvé dans le formulaire.");
|
||||
}
|
||||
}, 200);
|
||||
}, 300); // Augmentation légère du délai pour garantir le rendu du Selectpicker
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user