setHandler

9 views
Skip to first unread message

Tony

unread,
Feb 14, 2009, 4:19:37 PM2/14/09
to PHP-Ext
Hi

I want to create a button that opens a form.

I've got my own button class that, for the time being, just changes
the text of the button, just to see if I can achieve what I want:

<?php

include_once 'PhpExt/Button.php';
include_once 'PhpExt/Handler.php';
include_once 'PhpExt/Javascript.php';

class t_Button extends PhpExt_Button
{
function __construct()
{
parent::__construct();
$this->setText('t_button');
// $this->setHandler(new PhpExt_JavascriptStm("function(){alert
('yes');}"));
$this->setHandler(new PhpExt_Handler($this->testFn()));
}

function testFn()
{
$this->setText('changed');
// What I eventally want here is something like
// $dialog = new myNewUserDialog();
// etc
// where myNewUserDialog is my own custom dialog for creating
a new user for my app.
}
}

I feel as though I'm close, but the problem is that the event is fired
when the page is rendered, so that the text of the button is "changed"
as soon as the page is rendered and I never see it as "t_button".

Any ideas?

Thanks

Tony
Reply all
Reply to author
Forward
0 new messages