\n"; // End form-group
- break;
- }
+ $res .= $field->display ();
}
if ($group !== "")
@@ -621,6 +189,8 @@ class form
/** the definition of a formfield */
class formfield
{
+ /** The form name */
+ public $formName;
/** The name of the field */
public $name;
/** The label of the field */
@@ -630,7 +200,7 @@ class formfield
/** The defaults values of the field */
public $defaults;
/** The type of the field (text, password, checkbox, select)*/
- public $type;
+ public $type="text";
/** The multiplicity of selection of the field (available in select only)*/
public $multiple;
/** The name of group for the fields */
@@ -651,11 +221,481 @@ class formfield
/** When adding a field, the name and the label are the minimum mandatory
@param string $name Name of the field
@param string $label Label of the field */
- function __construct ($name, $label)
+ public function __construct ($name, $label)
{
$this->name = $name;
$this->label = $label;
}
+
+ /** Display really the form */
+ public function display ()
+ {
+ $func = "field".$this->type;
+ return $this->$func ();
+ }
+
+ /** Return the checkbox defined */
+ public function fieldcheckbox ()
+ {
+ // No $this->multiple, $this->rows $this->cols
+ $res = "";
+ $res .= "
\n"; // End form-group
+ return $res;
+ }
+
+ /** Return the radio field defined */
+ public function fieldradio ()
+ {
+ $res = "";
+ // No $this->multiple, $this->rows $this->cols
+ $res .= "