Loading src/UnicaenAutoform/View/Helper/partial/input/select_text.phtml +16 −7 Changes for src/UnicaenAutoform/View/Helper/partial/input/select_text.phtml: 16 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -15,15 +15,15 @@ $reponse = explode(':::', $reponse); <?php echo $champ->getLibelle(); ?> : </label> <div class="col-sm-9"> <select class="form-control" name="<?php echo $champ->getId(); ?>" id="<?php echo $champ->getId(); ?>" onchange="showComplement('option')"> <select class="form-control" name="<?php echo $champ->getId(); ?>" id="<?php echo $champ->getId(); ?>" onchange="showComplement(this.value)"> <option value="null"></option> <?php foreach ($options as $option) : ?> <option value="<?php echo $option; ?>" <?php if ($reponse[0] === $option) : ?> <option id="<?php echo trim($option); ?>" value="<?php echo trim($option); ?>" <?php if ($reponse[0] === trim($option)) : ?> selected <?php endif; ?> > <?php echo $option; ?> <?php echo trim($option); ?> </option> <?php endforeach; ?> </select> Loading @@ -45,9 +45,18 @@ $reponse = explode(':::', $reponse); <script> function showStuff(option) { document.getElementById("text_complementaire").style.display = 'block'; // document.getElementById("text_complementaire").style.display = 'none'; function showComplement(option) { console.log(option.substring(option.length - 1)); if (option != "") { if (option.substring(option.length - 1) == '*') { document.getElementById("text_complementaire").style.display = ''; } else { document.getElementById("text_complementaire").style.display = 'none'; } } else { document.getElementById("text_complementaire").style.display = 'none'; } } </script> Loading
src/UnicaenAutoform/View/Helper/partial/input/select_text.phtml +16 −7 Changes for src/UnicaenAutoform/View/Helper/partial/input/select_text.phtml: 16 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -15,15 +15,15 @@ $reponse = explode(':::', $reponse); <?php echo $champ->getLibelle(); ?> : </label> <div class="col-sm-9"> <select class="form-control" name="<?php echo $champ->getId(); ?>" id="<?php echo $champ->getId(); ?>" onchange="showComplement('option')"> <select class="form-control" name="<?php echo $champ->getId(); ?>" id="<?php echo $champ->getId(); ?>" onchange="showComplement(this.value)"> <option value="null"></option> <?php foreach ($options as $option) : ?> <option value="<?php echo $option; ?>" <?php if ($reponse[0] === $option) : ?> <option id="<?php echo trim($option); ?>" value="<?php echo trim($option); ?>" <?php if ($reponse[0] === trim($option)) : ?> selected <?php endif; ?> > <?php echo $option; ?> <?php echo trim($option); ?> </option> <?php endforeach; ?> </select> Loading @@ -45,9 +45,18 @@ $reponse = explode(':::', $reponse); <script> function showStuff(option) { document.getElementById("text_complementaire").style.display = 'block'; // document.getElementById("text_complementaire").style.display = 'none'; function showComplement(option) { console.log(option.substring(option.length - 1)); if (option != "") { if (option.substring(option.length - 1) == '*') { document.getElementById("text_complementaire").style.display = ''; } else { document.getElementById("text_complementaire").style.display = 'none'; } } else { document.getElementById("text_complementaire").style.display = 'none'; } } </script>