Je m'explique,

Dans une page de mon formulaire, je dois choisir un forfait (Forfait1, Forfait2...).
J'ai fait cela sous forme de liste déroulante.

Dans la page suivante, je dois afficher les options spécifiques au forfait sélectionné ou passer à la page d'après si ce forfait n'a pas d'option... comment puis-je faire ?



Voici une partie de mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
 
require_once("lib/header.php");
 
require_once 'HTML/QuickForm/Controller.php';
require_once 'HTML/QuickForm/Action/Next.php';
//require_once 'HTML/QuickForm/Action/Nextf.php';
require_once 'HTML/QuickForm/Action/Back.php';
require_once 'HTML/QuickForm/Action/Direct.php';
require_once 'HTML/QuickForm/Action/Display.php';
 
// Start the session, form-page values will be kept there
session_start();
 
ProtectedPage::displayHeader($GLOBALS[lTest]);
 
class PageFirst extends HTML_QuickForm_Page
{
    function buildForm()
    {
        //un formulaire avec plein de champs
    }
}
 
 
 
//------page de choix du forfait-----------
 
class PageSecond extends HTML_QuickForm_Page
{
    function buildForm()
	{
        $this->_formBuilt = true;
        $this->addElement('header',top, $GLOBALS[lPage2]);
 
		$forfait = array();
		for ($i=1; $i<$GLOBALS['MAX']; $i++){
			$forfait[$i] = 'Forfait'.$i;
		}
		$sel =& $this->addElement('hierselect', 'forfait', 'forfait :'); //liste déroulante
		$sel->setOptions(array($forfait));
 
		$prevnext[] =& $this->createElement('submit',$this->getButtonName('back'),$GLOBALS[lBack]);
		$this->addGroup($prevnext, null, '', '&nbsp;', false);
 
		$this->addElement('submit',$this->getButtonName('next'),$GLOBALS[lNext]);
		$this->setDefaultAction('next');
	}
}
 
//page de choix des options sur le forfait choisi
class PageThird extends HTML_QuickForm_Page
{
    function buildForm()
    {
		$this->_formBuilt = true;
                // ---- ici je dois afficher mes options ou pas ---
    }
}
 
 
class PageFourth extends HTML_QuickForm_Page
{
   //page à afficher s'il n'y a pas d'option pour le forfait choisi
 
    }
}
 
//-----------récap de la saisie :---------
class ActionProcess extends HTML_QuickForm_Action
{
    function perform(&$page, $actionName)
    {
 
        echo "<h1>Récapitulatif de la saisie</h1><br>\n<pre>\n";
        var_dump($page->controller->exportValues());
        echo "\n</pre>\n";
    }
}
 
$wizard =& new HTML_QuickForm_Controller('Wizard');
$wizard->addPage(new PageFirst('page1'));
$wizard->addPage(new PageSecond('page2'));
$wizard->addPage(new PageThird('page3'));
$wizard->addPage(new PageFourth('page4'));
 
// We actually add these handlers here for the sake of example
// They can be automatically loaded and added by the controller
 
$wizard->addAction('display', new HTML_QuickForm_Action_Display());
$wizard->addAction('next', new HTML_QuickForm_Action_Next());
$wizard->addAction('back', new HTML_QuickForm_Action_Back());
$wizard->addAction('direct', new HTML_QuickForm_Action_Direct());
 
 
// This is the action we should always define ourselves
$wizard->addAction('process', new ActionProcess());
$wizard->run();
Attention, je n'ai pas encore défini quel forfait a quelle option, ne sachant trop comment m'y prendre. Je ne peux pas utiliser de hierselect avec listes dépendantes les unes des autres car il y a toutes sortes d'options (des listes, des dates de validité,des champs de texte,...)


Merci d'avance pour votre aide