コード例 #1
0
 public function testFormHtml()
 {
     $form = BootBuilder::open();
     $form->setMethod("test.php");
     $form->add(new Text("sample_text"));
     $boxgroup = new StackPane("Sample checkbox");
     $boxgroup->addControl(new Checkbox("sample_unchecked"));
     $c = new Checkbox("sample_checked");
     $c->setChecked(true);
     $c->setDisabled(true);
     $boxgroup->addControl($c);
     $form->add($boxgroup);
     $html = $form->render(true);
     $this->assertContains("checkbox", $html);
     $this->assertContains("<form", $html);
     $this->assertContains("disabled", $html);
     $this->assertContains("stackpane", $html);
     $this->assertContains($c->getId(), $html);
     // Dynamic id's
 }
コード例 #2
0
$form = BootBuilder::openHorizontal();
$form->setAction("");
$form->setMethod("post");
$form->setId("stackedcontrols");
$form->add(new Text('sample_text', 'Testing Label', null, 'Default Value'));
$txt = new Text("sample2");
$txt->setPlaceholder("Placeholder here");
$txt->setLabel("This is a placeholder test");
$email = new Email("email", "Your e-mail");
$area = new TextArea("sample_area");
$password = new Password("login_password", "Password");
$checkb1 = new Checkbox("remember", "Remember my settings");
$checkb2 = new Checkbox("accept", "Accept our privacy policy");
$checkb2->setChecked(true);
// Create stackpane
$stack1 = new StackPane("Options");
$stack1->addAll($checkb1, $checkb2);
$radio1 = new Radio("envi", "Live version", "envi_live", "live");
$radio2 = new Radio("envi", "Development version", "envi_dev", "dev");
$radio1->setChecked(true);
// Create stackpane
$inline1 = new InlinePane("Select version");
$inline1->addControl($radio1);
$inline1->addControl($radio2);
$file1 = new File("file_sample", "Logo", "logo_file");
$hidden = new Hidden("testing_hidden", "Hidden Value");
$submit = new Submit("Send");
$cancel = new Button("Cancel");
$inline2 = new InlinePane("");
$inline2->addAll($submit, $cancel);
// Add all controls and panes to the form