<script src="../html/javascript/tiny_mce/tiny_mce_dev.js" type="text/javascript"></script> </head> <body> <?php require_once '../lib/Builder.php'; try { $oElement = new Builder_Helper_Element('Username'); $oElement->SetHint('Select a unique username')->SetDescription('Please enter a user name between 4 and 25 characters long')->SetValidation(new Builder_Helper_Validation(array('required' => true, 'length' => array('min' => 4, 'max' => 25))))->SetValue('Bob')->SetError('Username is already in use.'); $oRow = new Builder_Helper_Row('First Name'); $oRow->AddElement($oElement); // Combine all our rows $oRowsHelper = new Builder_Helper_Rows(); $oRowsHelper->AddRow($oRow); $oGroupHelper = new Builder_Helper_Group(); $oGroupHelper->SetHeading('Error on load.')->SetSubheading('This will show an error when the form loads. Useful for returning the user to a form to correct the data being captured.')->SetRows($oRowsHelper); // Combine our groups $oGroupsHelper = new Builder_Helper_Groups(); $oGroupsHelper->AddGroup($oGroupHelper); // Add our groups to our form helper and set some basic attributes $oFormHelper = new Builder_Helper_Form('test-form'); $oFormHelper->AddGroups($oGroupsHelper)->SetScript('post_to_this_form.php'); // Build our form $oForm = new Builder_Form(); echo $oForm->Render($oFormHelper->ToArray()); } catch (Exception $oException) { echo 'Exception: ' . $oException->getMessage(); } ?> </body> </html>
$oElement13->SetValue('Subscribe'); // Build a row for our submit button $oRow11 = new Builder_Helper_Row(); $oRow11->AddElement($oElement13); // Combine all our rows $oRowsHelper = new Builder_Helper_Rows(); $oRowsHelper->AddRow($oRow1)->AddRow($oRow2)->AddRow($oRow3)->AddRow($oRow4)->AddRow($oRow5)->AddRow($oRow6)->AddRow($oRow7)->AddRow($oRow8)->AddRow($oRow9)->AddRow($oRow10)->AddRow($oRow11); // Build a HTML element $oElement14 = new Builder_Helper_Element('marketing', Builder_Form_Element::TYPE_HTML); $oElement14->SetValue('Custom <b>HTML</b> can be entered <i>here</i>!<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>'); $oRow12 = new Builder_Helper_Row(); $oRow12->AddElement($oElement14)->SetRenderMode(Builder_Form::RENDER_MODE_INPUT_ONLY); $oRowsHelper2 = new Builder_Helper_Rows(); $oRowsHelper2->AddRow($oRow12); $oGroupHelper = new Builder_Helper_Group(); $oGroupHelper->SetHeading('Subscribe')->SetSubheading('Product Description.'); $oGroupHelper->SetRows($oRowsHelper2); // Group the rest of the form $oGroupHelper2 = new Builder_Helper_Group(); $oGroupHelper2->SetSubheading('Please provide these basic details to register.')->SetCopy("Out wonderful service will completely justify handing over all your private data. Don't worry. You can trust us. Read out <a href='non-existant.html'>Privacy Policy</a>."); $oGroupHelper2->SetRows($oRowsHelper); // Combine our groups $oGroupsHelper = new Builder_Helper_Groups(); $oGroupsHelper->AddGroup($oGroupHelper)->AddGroup($oGroupHelper2); // Add our groups to our form helper and set some basic attributes $oFormHelper = new Builder_Helper_Form('test-form'); $oFormHelper->AddGroups($oGroupsHelper)->SetScript('post_to_this_form.php'); // Build our form $oForm = new Builder_Form(); echo $oForm->Render($oFormHelper->ToArray()); } catch (Exception $oException) {