<?phpclass Button07 extends Page { private $text = null; public function InitializeComponent() { parent::$PAGE_TITLE = "Tutorial : Define default button"; $form = new Form($this); $this->text = new TextBox($form); $this->text->setValue("Enter your text"); $this->text->setStripTags("<b><i>"); $this->btn_val = new Button($form); $this->btn_val->setValue("Validate"); $this->btn_val->onClick("onClickButton"); $this->btn_val->setAjaxEvent(); $this->btn_cancel = new Button($form); $this->btn_cancel->setValue("Cancel"); $this->btn_cancel->onClick("onClickButton"); $this->btn_cancel->setAjaxEvent(); // To define default button $this->btn_cancel->assignEnterKey(); $btn_table = new Table(); $btn_table->addRowColumns($this->btn_val, $this->btn_cancel); $form_obj = new WSPObject($this->text, "<br/>", $btn_table); $form->setContent($form_obj); $this->render = $form; } public function onClickButton($sender) { if ($sender->getId() == $this->btn_val->getId()) { $dialog = new DialogBox("onClickButton", $this->text->getValue()); } else { $dialog = new DialogBox("onClickButton", "Cancel"); } $this->addObject($dialog); }}?>