Skip to content

Instantly share code, notes, and snippets.

@vakopian
Created March 17, 2013 22:21
Show Gist options
  • Save vakopian/5183904 to your computer and use it in GitHub Desktop.
Save vakopian/5183904 to your computer and use it in GitHub Desktop.
<?php
// Include prepend.inc to load Qcodo
require('includes/configuration/prepend.inc.php');
class ExampleForm extends QForm {
/** @var QAutocomplete */
protected $ac;
/** @var QJqButton */
protected $btnClear;
protected function Form_Create() {
$this->ac = new QAutocomplete($this);
$this->ac->Text = "Test";
$this->ac->UseWrapper = false;
// Button
$this->btnClear = new QJqButton($this);
$this->btnClear->Label = "Clear";
$this->btnClear->AddAction(new QClickEvent, new QAjaxAction("button_click"));
}
protected function button_click() {
$this->ac->Text = "";
}
}
ExampleForm::Run('ExampleForm');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php _p(QApplication::$EncodingType); ?>" />
<title>Sample QForm</title>
<style type="text/css">@import url("<?php _p(__VIRTUAL_DIRECTORY__ . __CSS_ASSETS__); ?>/styles.css");</style>
</head><body>
<?php $this->RenderBegin(); ?>
<?php $this->ac->Render(); ?>
<?php $this->btnClear->Render(); ?>
<?php $this->RenderEnd(); ?>
</body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment