diff options
| author | M <m@lfurio.us> | 2015-12-05 15:03:48 -0500 | 
|---|---|---|
| committer | M <m@lfurio.us> | 2015-12-05 15:03:48 -0500 | 
| commit | 59962f7c260aaa0661b0c811e6b553d1a850032b (patch) | |
| tree | 230007ea5c793dd41432e5d82218ca63dd747bc5 | |
| parent | 49e6128951e8d8b340ea6027735c8b3566c44b6b (diff) | |
| download | scrott-59962f7c260aaa0661b0c811e6b553d1a850032b.tar.gz scrott-59962f7c260aaa0661b0c811e6b553d1a850032b.zip | |
+ Added numeric and enum types to Form class
Diffstat (limited to '')
| -rw-r--r-- | app/class/form.class.php | 37 | 
1 files changed, 37 insertions, 0 deletions
| diff --git a/app/class/form.class.php b/app/class/form.class.php index e398690..ffee3d7 100644 --- a/app/class/form.class.php +++ b/app/class/form.class.php @@ -11,6 +11,8 @@ class Form      function __construct()      {          $this->textFields = array(); +        $this->numbFields = array(); +        $this->enumFields = array();          $this->errorlist   = array();          $this->warninglist = array(); @@ -30,6 +32,41 @@ class Form              'req'  => $req          );      } + +    /* +     * Add new numeric field to the form +     */ +    function field_numeric($name, $req = true, $integer = true, $min = null, $max = null) +    { +        if ($req !== true) +            $req = false; + +        if ($integer !== true) +            $integer = false; + +        $this->numbFields[] = array( +            'name' => $name, +            'req'  => $req, +            'int'  => $integer, +            'min'  => $min, +            'max'  => $max +        ); +    } + +    /* +     * Add new enumeration field to the form +     */ +    function field_enum($name, $req = true, $values) +    { +        if ($req !== true) +            $req = false; + +        $this->enumFields[] = array( +            'name' => $name, +            'req'  => $req, +            'vals' => $values +        ); +    }  }  ?> | 
