Qcube / Qcodo dynamic input fields

Does anyone have an example of how to add input fields dynamically to a qcubed project? Thanks!

+4
source share
1 answer

You can use the QPanel control to add controls on the fly. Just set the AutoRenderChildren attribute to true and set the parent of the dynamic controls to QPanel.

// Instantiate our QPanel - this will render a div to contain our dynamic controls // Note that the parent is $this. You will need to call render in your template $this->pnl = new QPanel($this); // Setting AutoRenderChildren so that the Panel will handle Rendering our dynamic // controls. $this->pnl->AutoRenderChildren = true; // Creating a button with an Ajax action to create our dynamic controls $this->btn = new QButton($this); $this->btn->Text = "Add Control"; $this->btn->AddAction(new QClickEvent(), new QAjaxAction('btn_Click')); protected function btn_Click($strFormId, $strControlId, $strParameter) { // create the control and set its parent to the QPanel $ctl = new QTextBox($this->pnl); } 

You can learn more about using QPanels on the QCubed Samples website.

QCubed QPanel Example

+1
source

All Articles