diff --git a/form.php b/form.php index 551e35c..be4339f 100644 --- a/form.php +++ b/form.php @@ -26,6 +26,11 @@ class form /** The method used to send the values */ private $method = "post"; + /** The Bootstrap width of the column of titles */ + public $titlewidth = 2; + /** The Bootstrap width of the column of fields */ + public $fieldswidth = 10; + /** Create a form @param string|null $formName The form name */ @@ -188,6 +193,8 @@ class form if (isset ($errors[$field->name]) && $errors[$field->name] !== "unset") $field->errors = $errors[$field->name]; + $field->titlewidth = $this->titlewidth; + $field->fieldwidth = $this->fieldwidth; $res .= $field->display (); } @@ -250,6 +257,10 @@ class formfield public $rows; /** Number of columns */ public $cols; + /** The Bootstrap width of the column of titles */ + public $titlewidth = 2; + /** The Bootstrap width of the column of fields */ + public $fieldswidth = 10; /** 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 */ @@ -275,7 +286,7 @@ class formfield if (isset ($this->errors)) $res .= " has-".$this->errors[0]; $res .= "'>\n"; - $res .= " \n"; - $res .= "
\n"; + $res .= "
\n"; if (count ($this->titles) === 0) $this->titles = array (""); foreach ($this->titles as $key=>$val) @@ -401,7 +412,7 @@ class formfield if (isset ($this->errors)) $res .= " has-".$this->errors[0]; $res .= "'>\n"; - $res .= " \n"; - $res .= "
\n"; + $res .= "
\n"; $res .= " name, ENT_QUOTES)."]'"; @@ -461,7 +472,7 @@ class formfield if (isset ($this->errors)) $res .= " has-".$this->errors[0]; $res .= "'>\n"; - $res .= " \n"; - $res .= "
\n"; + $res .= "
\n"; if (is_string ($this->defaults)) $this->defaults = array ($this->defaults); $res .= " errors)) $res .= " has-".$this->errors[0]; $res .= "'>\n"; - $res .= " \n"; - $res .= "
\n"; + $res .= "
\n"; if (isset ($this->defaults) && is_array ($this->defaults)) { if (isset ($this->readonly) && $this->readonly !== FALSE) @@ -640,7 +651,8 @@ class formfield // No $this->label, $this->multiple, $this->error, $this->rows, // $this->cols $res .= "
\n"; - $res .= "
\n"; + $res .= "
\n"; $res .= " name, ENT_QUOTES)."]'"; @@ -671,7 +683,7 @@ class formfield if (isset ($this->errors)) $res .= " has-".$this->errors[0]; $res .= "'>\n"; - $res .= " \n"; - $res .= "
\n"; + $res .= "
\n"; $res .= " name, ENT_QUOTES)."]'"; @@ -734,7 +746,7 @@ class formfield if (isset ($this->errors)) $res .= " has-".$this->errors[0]; $res .= "'>\n"; - $res .= " \n"; - $res .= "
\n"; + $res .= "
\n"; $res .= " name, ENT_QUOTES)."]'";