1: <?php
2: require_once('../qcubed.inc.php');
3:
4: 5: 6: 7: 8: 9: 10: 11:
12: class InjectForm extends QForm {
13: protected $panel;
14: protected $auto1;
15:
16: protected $btnServer;
17: protected $btnAjax;
18:
19: protected function Form_Create() {
20: $this->panel = new QPanel($this);
21: $this->panel->AutoRenderChildren = true;
22: $this->panel->SetCssStyle('border', '2px solid black');
23: $this->panel->Width = 200;
24: $this->panel->Height = 100;
25:
26: $this->btnServer = new QButton ($this);
27: $this->btnServer->Text = 'Server Submit';
28: $this->btnServer->AddAction(new QClickEvent(), new QServerAction('submit_click'));
29:
30: $this->btnAjax = new QButton ($this);
31: $this->btnAjax->Text = 'Ajax Submit';
32: $this->btnAjax->AddAction(new QClickEvent(), new QAjaxAction('submit_click'));
33: }
34:
35: protected function submit_click($strFormId, $strControlId, $strParameter) {
36: $this->insertAutoComplete();
37: }
38:
39: protected function insertAutoComplete() {
40: $this->auto1 = new QAutocomplete2($this->panel);
41: $this->auto1->Name = 'Autocomplete';
42:
43: $a = [new QListItem ('A', 1),
44: new QListItem ('B', 2),
45: new QListItem ('C', 3),
46: new QListItem ('D', 4)
47: ];
48:
49: $this->auto1->Source = $a;
50: }
51: }
52: InjectForm::Run('InjectForm');
53: ?>