[eZ Publish] ezsurvey : réponse obligatoire
Bonjour,
l'extension ezsurvey possède selon le type de champs collecté demandé une possibilité d'obliger la réponse à la question ou pas par la zone "réponse obligatoire".
Que je coche ou décoche cette option ne change rien dans le comportement de l'extension, le champs restant tout le temps obligatoire.
Quelqu'un aurait-il rencontrer ce problème ? et comment le résoudre ?
D'avance merci
Semi solution en attendant mieux...
Bonjour,
Dans le fichier ezsurveyquestion.php de l'extension, le champ mandatory (correspondant au champ réponse obligatoire) reçu de la variable POST est pris en compte uniquement si l'on reçoit de la variable POST le champ mandatory_hidden :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| $postQuestionMandatoryHidden = $prefix . '_ezsurvey_question_' . $this->ID . '_mandatory_hidden_' . $attributeID;
if ( $http->hasPostVariable( $postQuestionMandatoryHidden ) )
{
$postQuestionMandatory = $prefix . '_ezsurvey_question_' . $this->ID . '_mandatory_' . $attributeID;
if ( $http->hasPostVariable( $postQuestionMandatory ) )
$newMandatory = 1;
else
$newMandatory = 0;
if ( $newMandatory != $this->Mandatory )
$this->setAttribute( 'mandatory', $newMandatory );
} |
Or ceci n'est pas le cas malgré la présence sur le formulaire d'un champ de type input :
Code:
1 2 3 4 5
| <div class="block">
<input type="hidden" name="{$prefix_attribute}_ezsurvey_question_{$question.id}_mandatory_hidden_{$attribute_id}" value="1" />
<label><input type="checkbox" name="{$prefix_attribute}_ezsurvey_question_{$question.id}_mandatory_{$attribute_id}" value="1"{section show=$question.mandatory} checked="checked"{/section} />
{"Mandatory answer"|i18n('survey')}</label>
</div> |
et celà reste un mystère à résoudre... avis aux amateurs...
Pour résoudre ce problème (et dont je ne vois pas trop l'interêt du test de ce champ ???), il suffit de supprimer le test de la réception de cette variable dans la variable POST comme ci après :
Code:
1 2 3 4 5 6 7 8 9 10 11
| //if ( $http->hasPostVariable( $postQuestionMandatoryHidden ) )
//{
$postQuestionMandatory = $prefix . '_ezsurvey_question_' . $this->ID . '_mandatory_' . $attributeID;
if ( $http->hasPostVariable( $postQuestionMandatory ) )
$newMandatory = 1;
else
$newMandatory = 0;
if ( $newMandatory != $this->Mandatory )
$this->setAttribute( 'mandatory', $newMandatory );
//} |
Voilà donc une solution pas très propre je l'admet mais qui résout le problème en attendant mieux....