Login   Register  
PHP Classes
elePHPant
Icontem

File: Example

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Jakub Kuritka  >  Leopard Form  >  Example  >  Download  
File: Example
Role: Example script
Content type: text/plain
Description: Example of using leopardForm
Class: Leopard Form
Compose, output and validate HTML forms
Author: By
Last change: Renamed jablko (in czech language) to apple
Date: 2011-03-22 01:23
Size: 1,098 bytes
 

Contents

Class file image Download
        $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;
    }