Commit 27a4ef91 authored by Théo GUILLON's avatar Théo GUILLON
Browse files

Correction : ajout valeur vide à la création d'un menu déroulant

Correction : affichage entre la création JS du champ et au moment de l'édition
parent 3f33a775
......@@ -114,7 +114,7 @@ foreach ($champs as $key => $value) {
foreach ($details['options'] as $key => $val) {
$checked = "";
if (isset($details['default'])) {
if (in_array($key, $details['default'])) {
if (in_array($details['name'].$key, $details['default'])) {
$checked = "checked";
}
}
......@@ -145,13 +145,13 @@ foreach ($champs as $key => $value) {
foreach ($details['options'] as $key => $val) {
$checked = "";
if (isset($details['default'])) {
if ($val === $details['default']) {
if ($details['default'] === $details['name'].$key) {
$checked = "checked";
}
}
echo '<div class="radio">'
. '<input id="'.$key.'" class="champNomVariableReadonly" type="radio" '.$checked.' name="'.$details['name'].'" value="'.$val.'">'.$val.'</div>';
. '<input id="'.$details['name'].$key.'" class="champNomVariableReadonly" type="radio" '.$checked.' name="'.$details['name'].'" value="'.$val.'">'.$val.'</div>';
}
echo '</div></div>';
break;
......@@ -166,17 +166,17 @@ foreach ($champs as $key => $value) {
. '</label>'
. '</div>'
. '<div class="col-md-8">'
. '<select id="'.$details['name'].'" class="usersDeroulant transformSelect form-control" name ="data[Fiche]['.$details['name'].']" data-placeholder=" ">'
. '<option name ="'.$details['name'].'" value=""></option>';
. '<select id="'.$details['name'].'" class="transformSelect form-control contentDeroulant" name="data[Fiche]['.$details['name'].']" data-placeholder=" ">'
. '<option name="'.$details['name'].'" value=""></option>';
foreach ($details['options'] as $key => $val) {
$selected = "";
if (isset($details['default'])) {
if ($val === $details['default']) {
$selected = " result-selected";
if ($details['default'] === $details['name'].$key) {
$selected = "selected";
}
}
echo '<option id="'.$key.'" class="champNomVariableReadonly" type="deroulant" '.$selected.' name ="'.$details['name'].'" value="'.$val.'">'.$val.'</option></div>';
echo '<option id="'.$details['name'].$key.'" class="champNomVariableReadonly" type="deroulant" '.$selected.' name ="'.$details['name'].'" value="'.$val.'">'.$val.'</option></div>';
}
echo '</select>'
. '</div>'
......@@ -197,12 +197,12 @@ foreach ($champs as $key => $value) {
foreach ($details['options'] as $key => $val) {
$selected = "";
if (isset($details['default'])) {
if (in_array($key, $details['default'])) {
if (in_array($details['name'].$key, $details['default'])) {
$selected = 'selected';
}
}
echo '<option id="'.$key.'" class="champNomVariableReadonly" '.$selected.' name="'.$details['name'].'" value="'.$val.'"> '.$val.'</option>';
echo '<option id="'.$details['name'].$key.'" class="champNomVariableReadonly" '.$selected.' name="'.$details['name'].'" value="'.$val.'"> '.$val.'</option>';
}
echo '</select>'
.'</div>'
......
......@@ -1088,8 +1088,10 @@ var createForm = function(typeCreateForm) {
// Attribution les valeurs au champ "Menu déroulant"
if ($(this).hasClass('deroulant')) {
objet = objet + '<option name="'+newNameField+'" value=""></option>';
$.each(newOptionsField, function (index, value) {
objet = objet + '<option id="'+index+'" name="'+newNameField+'" value="'+value+'">' +
objet = objet + '<option id="'+newNameField+index+'" name="'+newNameField+'" value="'+value+'">' +
value +
'</option>';
});
......@@ -1104,7 +1106,7 @@ var createForm = function(typeCreateForm) {
// Attribution les valeurs au champ "Menu multi-sélect"
if ($(this).hasClass('multi-select')) {
$.each(newOptionsField, function (index, value) {
objet = objet + '<option id="'+index+'" name="'+newNameField+'" value="'+value+'">' +
objet = objet + '<option id="'+newNameField+index+'" name="'+newNameField+'" value="'+value+'">' +
value +
'</option>';
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment