Loading src/UnicaenAutoform/View/Helper/partial/input/plus_custom.phtml +20 −19 Original line number Diff line number Diff line Loading @@ -9,7 +9,9 @@ use UnicaenAutoform\Entity\Db\Champ; $options = ($champ->getOptions() !== null) ?? explode(';', $champ->getOptions()); $temp = ($reponse) ? explode(';', $reponse) : []; $temp = array_map(function ($s) { return "'".$s."'";}, $temp); $temp = array_map(function ($s) { return "'" . $s . "'"; }, $temp); $array = "[" . implode(",", $temp) . "]"; ?> Loading @@ -22,7 +24,8 @@ $array = "[" . implode(",", $temp) . "]"; <?php endif; ?> <br> <span id="<?php echo $champ->getId(); ?>" class="ajouter btn btn-primary" onclick="ajouter_PlusCustom(<?php echo $champ->getId(); ?>, readOptions('<?php echo $champ->getOptions(); ?>'))"> <span id="<?php echo $champ->getId(); ?>" class="ajouter btn btn-primary" onclick="ajouter_PlusCustom(<?php echo $champ->getId(); ?>, readOptions('<?php echo $champ->getOptions(); ?>'))"> <span class="icon icon-ajouter"></span> Ajouter </span> Loading @@ -44,25 +47,23 @@ $array = "[" . implode(",", $temp) . "]"; let fields = readOptions(optionsText); let reponses = '<?php echo $reponse; ?>'; // console.log(fields); let dictionnary = []; let blob = reponses.split('|'); for (let i = 0; i < blob.length; i++) { dictionnary[i] = blob[i].split(';'); } readOptions(optionsText); let sid = <?php echo $champ->getId(); ?>; console.log('HERE'); console.log(dictionnary); console.log("Init du champ : " + sid); console.log(dictionnary); if (dictionnary !== ['']) { for (let i = 0; i < dictionnary.length; i++) { console.log(dictionnary[i]); console.log(dictionnary[i][0]); if (dictionnary[i][0] !== "") { ajouter_PlusCustom(sid, fields, dictionnary[i]); } else { if (i === 0) ajouter_PlusCustom(sid, fields); } } } Loading Loading
src/UnicaenAutoform/View/Helper/partial/input/plus_custom.phtml +20 −19 Original line number Diff line number Diff line Loading @@ -9,7 +9,9 @@ use UnicaenAutoform\Entity\Db\Champ; $options = ($champ->getOptions() !== null) ?? explode(';', $champ->getOptions()); $temp = ($reponse) ? explode(';', $reponse) : []; $temp = array_map(function ($s) { return "'".$s."'";}, $temp); $temp = array_map(function ($s) { return "'" . $s . "'"; }, $temp); $array = "[" . implode(",", $temp) . "]"; ?> Loading @@ -22,7 +24,8 @@ $array = "[" . implode(",", $temp) . "]"; <?php endif; ?> <br> <span id="<?php echo $champ->getId(); ?>" class="ajouter btn btn-primary" onclick="ajouter_PlusCustom(<?php echo $champ->getId(); ?>, readOptions('<?php echo $champ->getOptions(); ?>'))"> <span id="<?php echo $champ->getId(); ?>" class="ajouter btn btn-primary" onclick="ajouter_PlusCustom(<?php echo $champ->getId(); ?>, readOptions('<?php echo $champ->getOptions(); ?>'))"> <span class="icon icon-ajouter"></span> Ajouter </span> Loading @@ -44,25 +47,23 @@ $array = "[" . implode(",", $temp) . "]"; let fields = readOptions(optionsText); let reponses = '<?php echo $reponse; ?>'; // console.log(fields); let dictionnary = []; let blob = reponses.split('|'); for (let i = 0; i < blob.length; i++) { dictionnary[i] = blob[i].split(';'); } readOptions(optionsText); let sid = <?php echo $champ->getId(); ?>; console.log('HERE'); console.log(dictionnary); console.log("Init du champ : " + sid); console.log(dictionnary); if (dictionnary !== ['']) { for (let i = 0; i < dictionnary.length; i++) { console.log(dictionnary[i]); console.log(dictionnary[i][0]); if (dictionnary[i][0] !== "") { ajouter_PlusCustom(sid, fields, dictionnary[i]); } else { if (i === 0) ajouter_PlusCustom(sid, fields); } } } Loading