$simple = new PhpExt_Form_FormPanel(); $simple->setLabelWidth(75)->setUrl("save-form.php")->setFrame(true)->setTitle("Simple Form")->setBodyStyle("padding:5px 5px 0")->setWidth(350)->setDefaults(new PhpExt_Config_ConfigObject(array("width" => 230)))->setDefaultType("textfield"); $firstName = PhpExt_Form_TextField::createTextField("first", "First Name")->setAllowBlank(false); $lastName = PhpExt_Form_TextField::createTextField("last", "Last Name"); $company = PhpExt_Form_TextField::createTextField("company", "Company"); $email = PhpExt_Form_TextField::createTextField("email", "Email", null, PhpExt_Form_FormPanel::VTYPE_EMAIL); $time = PhpExt_Form_TimeField::createTimeField("time", "Time")->setMinValue("8:00am")->setMaxValue("6:00pm"); $simple->addItem($firstName)->addItem($lastName)->addItem($company)->addItem($email)->addItem($time); $simple->addButton(PhpExt_Button::createTextButton("Save")); $simple->addButton(PhpExt_Button::createTextButton("Cancel")); //****************************** Adding Fieldset $fsf = new PhpExt_Form_FormPanel(); $fsf->setLabelWidth(75)->setUrl("save-form.php")->setFrame(true)->setTitle("Simple Form with FieldSets")->setBodyStyle("padding:5px 5px 0")->setWidth(350); //- Fielset 1 $fieldset1 = new PhpExt_Form_FieldSet(); $fieldset1->setCheckboxToggle(true)->setTitle("User Information")->setAutoHeight(true)->setDefaults(new PhpExt_Config_ConfigObject(array("width" => 210)))->setCollapsed(true); // Use the helper function to easily create fields to add them inline $fieldset1->addItem(PhpExt_Form_TextField::createTextField("first", "First Name")->setAllowBlank(false))->addItem(PhpExt_Form_TextField::createTextField("last", "Last Name"))->addItem(PhpExt_Form_TextField::createTextField("company", "Company"))->addItem(PhpExt_Form_TextField::createTextField("email", "Email")->setVType(PhpExt_Form_FormPanel::VTYPE_EMAIL)); $fsf->addItem($fieldset1); //- Fieldset 2 $fieldset2 = new PhpExt_Form_FieldSet(); $fieldset2->setTitle("Phone Number")->setCollapsible(true)->setAutoHeight(true)->setDefaults(new PhpExt_Config_ConfigObject(array("width" => 210)))->addItem(PhpExt_Form_TextField::createTextField("home", "Home")->setValue("(888) 555-1212"))->addItem(PhpExt_Form_TextField::createTextField("business", "Business"))->addItem(PhpExt_Form_TextField::createTextField("mobile", "Mobile"))->addItem(PhpExt_Form_TextField::createTextField("fax", "Fax")); $fsf->addItem($fieldset2); //- Buttons $fsf->addButton(PhpExt_Button::createTextButton("Save")); $fsf->addButton(PhpExt_Button::createTextButton("Cancel")); //****************************** A little more complex $top = new PhpExt_Form_FormPanel(); $top->setLabelAlign(PhpExt_Form_FormPanel::LABEL_ALIGN_TOP)->setFrame(true)->setTitle("Multi Column, Nested Layouts and Anchoring")->setBodyStyle("padding:5px 5px 0")->setWidth(600); $columnPanel = new PhpExt_Panel(); // using ColumnLayout