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
 }
    $form->setId("sampleform");
    $form->setMethod("post");
    $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");
    $txt->setRequired(true);
    $txt->setHelpText("Enter some text here to test stuff!");
    $email = new Email("email", "Your e-mail");
    $email->setRequired(true);
    $email->setHelpText("Valid email required!");
    $area = new TextArea("sample_area");
    $password = new Password("login_password", "Password");
    $password->setDisabled(true);
    $checkb1 = new Checkbox("remember", "Remember my settings");
    $checkb2 = new Checkbox("accept", "Accept our privacy policy");
    $checkb2->setChecked(true);
    $radio1 = new Radio("envi", "Live version", "envi_live", "live");
    $radio2 = new Radio("envi", "Development version", "envi_dev", "dev");
    $radio1->setChecked(true);
    $select1 = new Select("select_test", "Select branche");
    $select1->setOptions(array("master" => "Master branche", "dev" => "dev", "testing1" => "Highly testing, mostly broken"));
    $select1->setValue("testing1");
    $file1 = new File("file_sample", "Logo", "logo_file");
    $hidden = new Hidden("testing_hidden", "Hidden Value");
    $customhtml = new CustomHtml("<hr>");
    $submit = new Submit("Send");
    $form->addAll($txt, $email, $area, $password, $checkb1, $checkb2, $radio1, $radio2, $select1, $file1, $hidden, $customhtml, $submit);
}
$form->save();
$form->render();
Beispiel #3
0
use bootbuilder\Controls\Submit, bootbuilder\Controls\Checkbox, bootbuilder\Controls\File, bootbuilder\Controls\Hidden;
use bootbuilder\Controls\Password, bootbuilder\Controls\Radio;
use bootbuilder\Pane\StackPane, bootbuilder\Pane\InlinePane;
$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");