QDialogBox and QServerAction.
Thu, 03/31/2011 - 12:36
I have got some problem with QDialogBox and QServerAction in QCubed 2.0.2. If I click on button with server action in the dialog, the dialog box seems to go into the form after the page refresh instead of staying on top.
Any ideas to fix this?
Minimum code to replicate:
test.php
<?php
require('./includes/prepend.inc.php');
class Test extends QForm{
protected $dlgTest;
protected $btnTest;
protected function Form_Create(){
$this->dlgTest = new QDialogBox($this);
$this->dlgTest->AutoRenderChildren = true;
$this->dlgTest->ShowDialogBox();
$this->btnTest = new QButton($this->dlgTest);
$this->btnTest->Text = 'Click me';
$this->btnTest->AddAction(new QClickEvent(), new QServerAction(''));
}
}
Test::Run('Test');
?>test.tpl.php
<html>
<?php $this->RenderBegin(); ?>
<?php $this->dlgTest->Render(); ?>
<?php $this->RenderEnd(); ?>
</html>
Hello,
Without having a thorough thought about it I would say it is a bug. The system does not remember the state of the dialog box correctly.
However, you could fix it by calling:
<?php$this->dlgTest->Show/HideDialogBox(); // Whatever state you need
?>
in the server action.
Cheers
Helge
Thanks for the workaround, it works :)
Brynjar