4. Basic QForms
Hello World Example
<< (About Sections 4 - 10)   |   Back to Main   |   QForms: Stateful, Event-Driven Objects >>

View Source
will open in a new window
Learning the Basics
Welcome to your first QForm! This example shows how you can create a few QControl objects (in this case, a QLabel and a QButton) and set their text inside. It also assigns a QClickEvent on the button to a QServerAction. This server action (which is a PHP method) will simply modify the label to say "Hello, World!".

All QForm objects use an HTML include file -- in thise case, we define the HTML in the intro.tpl.php file. Note that there are RenderBegin() and RenderEnd() methods which are required to be called within the template in order to output the appropriate <form> tags, and also outputs any additional HTML and JavaScript that makes the QForm work. (Qcodo will in fact throw an exception if either RenderBegin and RenderEnd are not called.)

Click on the "View Source" link in the upper righthand corner to view the intro.php and intro.tpl.php code, which together define this QForm you are seeing.

Hello World Example

Click the button to change my message.