$form = new leopardForm("name", "index.php", "POST");
$form->addText("Stupid form");
$form->addTextInput("number", "Write number from 5 to 10","",array(rules::NUMBER, rules::MINI => 5, rules::MAXI => 10));
$form->addTextInput("url", "Site url", "http://",array(rules::URL));
$form->addPassword("passwd", "Write password", array(rules::NOTEMPTY));
$form->addRadio("gender", "Select your gender", array("m" => "men","w" => "women"),"m",false,array(rules::NOTEMPTY));
$form->addSelect("select", "Choose fruit", array("a" => "apple", "o" => "orange"), "apple",array(rules::NOTEMPTY));
$form->addTextArea("textarea", "Lang text", "",array(rules::NOTEMPTY));
$form->addCheckBox("Terms", array("t" => "I accept the terms of use","t2" => "I accept the second terms of use"),array("t2"),false,array(rules::NOTEMPTY));
$form->addSubmit("Submit");
$form->addButton("Button", "value", "reset");
if($form->requested()){
if($form->validate()){
echo $form->getData(formElement::TEXTINPUT, "number");
} else {
echo $form;
}
} else {
echo $form;
}
|