From 3dcb3c4188c8d5836a2db0847d2fc43bc7e7e4d8 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 20 Feb 2006 06:23:38 +0000 Subject: Cleaned up TForm and THead. --- framework/Web/UI/TForm.php | 54 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 11 deletions(-) (limited to 'framework/Web/UI/TForm.php') diff --git a/framework/Web/UI/TForm.php b/framework/Web/UI/TForm.php index 538cf8cd..317b0158 100644 --- a/framework/Web/UI/TForm.php +++ b/framework/Web/UI/TForm.php @@ -13,6 +13,15 @@ /** * TForm class * + * TForm displays an HTML form. Besides regular body content, + * it displays hidden fields, javascript blocks and files that are registered + * through {@link TClientScriptManager}. + * + * A TForm is required for a page that needs postback. + * Each page can contain at most one TForm. If multiple HTML forms are needed, + * please use regular HTML form tags for those forms that post to different + * URLs. + * * @author Qiang Xue * @version $Revision: $ $Date: $ * @package System.Web.UI @@ -30,6 +39,10 @@ class TForm extends TControl $this->getPage()->setForm($this); } + /** + * Adds form specific attributes to renderer. + * @param THtmlWriter writer + */ protected function addAttributesToRender($writer) { $writer->addAttribute('id',$this->getClientID()); @@ -52,7 +65,8 @@ class TForm extends TControl } /** - * @internal + * Renders the form. + * @param THtmlWriter writer */ public function render($writer) { @@ -65,46 +79,64 @@ class TForm extends TControl $writer->renderEndTag(); } + /** + * @return string id path to the default button control. + */ public function getDefaultButton() { return $this->getViewState('DefaultButton',''); } + /** + * Sets a button to be default one in a form. + * A default button will be clicked if a user presses 'Enter' key within + * the form. + * @param string id path to the default button control. + */ public function setDefaultButton($value) { $this->setViewState('DefaultButton',$value,''); } - public function getDefaultFocus() - { - return $this->getViewState('DefaultFocus',''); - } - - public function setDefaultFocus($value) - { - $this->setViewState('DefaultFocus',$value,''); - } - + /** + * @return string form submission method. Defaults to 'post'. + */ public function getMethod() { return $this->getViewState('Method','post'); } + /** + * @param string form submission method. Valid values include 'post' and 'get'. + */ public function setMethod($value) { $this->setViewState('Method',TPropertyValue::ensureEnum($value,'post','get'),'post'); } + /** + * @return string the encoding type a browser uses to post data back to the server + */ public function getEnctype() { return $this->getViewState('Enctype',''); } + /** + * @param string the encoding type a browser uses to post data back to the server. + * Commonly used types include + * - application/x-www-form-urlencoded : Form data is encoded as name/value pairs. This is the standard encoding format. + * - multipart/form-data : Form data is encoded as a message with a separate part for each control on the page. + * - text/plain : Form data is encoded in plain text, without any control or formatting characters. + */ public function setEnctype($value) { $this->setViewState('Enctype',$value,''); } + /** + * @return string form name, which is equal to {@link getUniqueID UniqueID}. + */ public function getName() { return $this->getUniqueID(); -- cgit v1.2.3