Ajout logs 2
This commit is contained in:
parent
ee0f3e8ddb
commit
524e4bf12c
@ -350,6 +350,20 @@ function preselectValues(eventData) {
|
||||
// Vérifier si l'option avec cette valeur existe
|
||||
const optionExists = Array.from(element.options).some(opt => opt.value === value.toString());
|
||||
console.log(`🔍 [PRESELECT] L'option avec valeur "${value}" existe:`, optionExists);
|
||||
|
||||
// Si Select2 n'est pas initialisé pour le champ langue, l'initialiser maintenant
|
||||
if (window.jQuery && !jQuery(element).hasClass('select2-hidden-accessible')) {
|
||||
console.log('🔧 [PRESELECT] Select2 non initialisé pour langue, initialisation...');
|
||||
if (window.jQuery.fn.select2) {
|
||||
jQuery(element).select2({
|
||||
width: '100%',
|
||||
placeholder: 'Sélectionner...',
|
||||
allowClear: true,
|
||||
dropdownParent: jQuery('#eventModal')
|
||||
});
|
||||
console.log('✅ [PRESELECT] Select2 initialisé pour langue');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (window.jQuery && jQuery(element).hasClass('select2-hidden-accessible')) {
|
||||
@ -359,6 +373,10 @@ function preselectValues(eventData) {
|
||||
// Vérifier si la valeur a bien été définie
|
||||
const actualValue = jQuery(element).val();
|
||||
console.log(`🔍 [PRESELECT] Valeur après définition pour ${fieldId}:`, actualValue, 'attendue:', value);
|
||||
|
||||
if (actualValue !== value && actualValue !== value.toString()) {
|
||||
console.warn(`⚠️ [PRESELECT] La valeur n'a pas été correctement définie pour ${fieldId}!`);
|
||||
}
|
||||
} else {
|
||||
console.log(`🔍 [PRESELECT] Utilisation de value standard pour ${fieldId}, valeur: ${value}`);
|
||||
element.value = value;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user