1: <?php require_once('../qcubed.inc.php');
2:
3: class PersistentExampleForm extends QForm {
4:
5: protected $ddnProjectPicker1;
6: protected $ddnProjectPicker2;
7: protected $fld1;
8: protected $fld2;
9:
10: protected $btnReload;
11:
12: protected function Form_Create() {
13:
14: $this->ddnProjectPicker1 = new ProjectPickerListBox ($this);
15: $this->ddnProjectPicker2 = new ProjectPickerListBox ($this);
16: $this->ddnProjectPicker2->SaveState = true;
17:
18: $this->fld1 = new QTextBox($this);
19: $this->fld1->Text = 'Change Me';
20: $this->fld2 = new QTextBox($this);
21: $this->fld2->Text = 'Change Me';
22: $this->fld2->SaveState = true;
23:
24: $this->btnReload = new QButton($this);
25: $this->btnReload->Text = 'Reload the Page';
26:
27: $this->btnReload->AddAction (new QClickEvent(), new QAjaxAction('btnReload_Click'));
28: }
29:
30: protected function btnReload_Click() {
31: QApplication::Redirect('persist.php');
32: }
33: }
34:
35: 36: 37: 38:
39: class ProjectPickerListBox extends QListBox {
40:
41: 42: 43: 44: 45:
46: public function __construct($objParentObject) {
47: parent::__construct($objParentObject);
48:
49: $projects = Project::QueryArray(
50: QQ::All(),
51: QQ::OrderBy(QQN::Project()->Name)
52: );
53:
54: foreach ($projects as $project) {
55: $this->AddItem($project->Name, $project->Id);
56: }
57: }
58: }
59:
60: PersistentExampleForm::Run('PersistentExampleForm');
61:
62: ?>
63: