Skip to content
Snippets Groups Projects
Commit 680ac1d0 authored by Florian Joriot's avatar Florian Joriot
Browse files

Correction mineur + affichage form validé

parent 2650adad
No related branches found
No related tags found
No related merge requests found
Pipeline #24774 passed
...@@ -186,7 +186,7 @@ class FormulaireReponseService ...@@ -186,7 +186,7 @@ class FormulaireReponseService
if (isset($data[$champ->getId()])) { if (isset($data[$champ->getId()])) {
$value = $data[$champ->getId()]; $value = $data[$champ->getId()];
if ($value != null && str_ends_with($data[$champ->getId()], '*') && isset($data['text_complementaire_'.$champ->getId()])) { if ($value != null && str_ends_with($data[$champ->getId()], '*') && isset($data['text_complementaire_'.$champ->getId()])) {
return $data[$champ->getId()] . ":::" . $data['text_complementaire'.$champ->getId()]; return $data[$champ->getId()] . ":::" . $data['text_complementaire_'.$champ->getId()];
} else { } else {
return ($value !== 'null') ? $value : null; return ($value !== 'null') ? $value : null;
} }
......
...@@ -51,7 +51,8 @@ class ChampAsResultHelper extends AbstractHelper ...@@ -51,7 +51,8 @@ class ChampAsResultHelper extends AbstractHelper
$texte .= $view->partial('result/select', ['champ' => $champ, 'data' => $data]); $texte .= $view->partial('result/select', ['champ' => $champ, 'data' => $data]);
break; break;
case Champ::TYPE_SELECT_TEXT : case Champ::TYPE_SELECT_TEXT :
$texte .= $view->partial('result/select_text', ['champ' => $champ, 'data' => $data]); $reponse = explode(":::", (string)$data);
$texte .= $view->partial('result/select_text', ['champ' => $champ, 'data' => $reponse]);
break; break;
case Champ::TYPE_ANNEE : case Champ::TYPE_ANNEE :
$texte .= $view->partial('result/annee', ['champ' => $champ, 'data' => $data]); $texte .= $view->partial('result/annee', ['champ' => $champ, 'data' => $data]);
......
...@@ -15,7 +15,7 @@ $reponse = explode(':::', $reponse); ...@@ -15,7 +15,7 @@ $reponse = explode(':::', $reponse);
<label for="<?php echo $champ->getId() ?>" class="control-label"> <label for="<?php echo $champ->getId() ?>" class="control-label">
<strong><?php echo $champ->getLibelle(); ?>&nbsp;:</strong> <strong><?php echo $champ->getLibelle(); ?>&nbsp;:</strong>
</label> </label>
<select class="form-control col-md-12" name="<?php echo $champ->getId(); ?>" id="<?php echo $champ->getId(); ?>" <select class="form-control col-md-12 select_text" name="<?php echo $champ->getId(); ?>" id="<?php echo $champ->getId(); ?>"
onchange="showComplement(this.value, this.name)"> onchange="showComplement(this.value, this.name)">
<option value="null"></option> <option value="null"></option>
<?php foreach ($options as $option) : ?> <?php foreach ($options as $option) : ?>
...@@ -49,7 +49,6 @@ $reponse = explode(':::', $reponse); ...@@ -49,7 +49,6 @@ $reponse = explode(':::', $reponse);
function showComplement(option, name) function showComplement(option, name)
{ {
console.log(option.substring(option.length - 1));
if (option !== "") { if (option !== "") {
if (option.substring(option.length - 1) === '*') { if (option.substring(option.length - 1) === '*') {
document.getElementById("text_complementaire_" + name).style.display = ''; document.getElementById("text_complementaire_" + name).style.display = '';
...@@ -60,5 +59,18 @@ $reponse = explode(':::', $reponse); ...@@ -60,5 +59,18 @@ $reponse = explode(':::', $reponse);
document.getElementById("text_complementaire_" + name).style.display = 'none'; document.getElementById("text_complementaire_" + name).style.display = 'none';
} }
} }
function instancieSelect(element)
{
showComplement(element.value,element.id)
}
$( document ).ready(function() {
selects = document.getElementsByClassName("select_text");
console.log(selects);
for (var i = 0; i < selects.length; i++) {
instancieSelect(selects[i]);
}
});
</script> </script>
<?php <?php
/** /**
* @var Champ $champ * @var Champ $champ
* @var string $data * @var array $data
*/ */
use UnicaenAutoform\Entity\Db\Champ; use UnicaenAutoform\Entity\Db\Champ;
?> ?>
<?php if ($data !== 'null') : ?> <strong><?php echo $champ->getLibelle(); ?>&nbsp;:</strong><br>
<?php echo $champ->getLibelle(); ?>&nbsp;:&nbsp;<?php echo $data; ?> <?php if (isset($data[0])) : ?>
<?php echo "Réponse sélectionner : ". $data[0]; ?>
<?php if (isset($data[1])) : ?>
<br><?php echo 'complément de réponse : '.$data[1]; ?>
<?php endif; ?>
<?php endif; ?> <?php endif; ?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment