"; + $res .= htmlspecialchars($this->errors[1]); + $res .= "
\n"; + } + if (isset($this->help)) { + $res .= "name, ENT_QUOTES) . "_help'>"; + $res .= $this->help; + $res .= "
\n"; + } + $res .= "diff --git a/src/Form.php b/src/Form.php index 58124ff..2026673 100644 --- a/src/Form.php +++ b/src/Form.php @@ -172,7 +172,7 @@ class Form /** * Set the Form Templating to use. - * Can be : Bootstrap3, Bootstrap4 (later Bulma) + * Can be : Bootstrap3, Bootstrap4 Bulma1 * @param string $formTemplate The template to use */ public function formTemplate($formTemplate): self @@ -180,7 +180,7 @@ class Form if ( ! in_array( $formTemplate, - ["Bootstrap3", "Bootstrap4"], + ["Bootstrap3", "Bootstrap4", "Bulma1"], true ) ) { @@ -354,7 +354,10 @@ class Form if ($this->formName != "") { $res .= " id='$this->formName'"; } - $res .= " class='" . $this->formClass . "'>\n"; + if ($this->formTemplate !== "Bulma1") { + $res .= " class='" . $this->formClass . "'"; + } + $res .= ">\n"; $group = ""; if (isset($_SESSION["domframework"]["form"][$this->formName]["values"])) { $values = $_SESSION["domframework"]["form"][$this->formName]["values"]; @@ -364,6 +367,7 @@ class Form } foreach ($this->fields as $field) { $field->formName = $this->formName; + $field->formClass = $this->formClass; if ( isset($field->group) && $field->group !== $group && $group !== "" || !isset($field->group) && $group !== "" diff --git a/src/Formfield.php b/src/Formfield.php index 4a478f9..6ded760 100644 --- a/src/Formfield.php +++ b/src/Formfield.php @@ -18,6 +18,10 @@ class Formfield * The form name */ public $formName; + /** + * The form class (horizontal / vertical) + */ + public $formClass; /** * The name of the field */ @@ -74,7 +78,7 @@ class Formfield /** * The statut of error of the field */ - public $error; + public $errors; /** * Number of rows */ @@ -1875,4 +1879,993 @@ class Formfield $res .= " \n"; // End form-group return $res; } + + ////////////////////// + //// BULMA1 //// + ////////////////////// + /** + * Return the checkbox defined + */ + private function fieldBulma1checkbox(): string + { + // No $this->multiple, $this->rows $this->cols $this->placeholder, + // $this->maxlength + if (! is_array($this->titles) || count($this->titles) === 0) { + $titles = [""]; + } else { + $titles = $this->titles; + } + $res = ""; + return $res; + } + + /** + * Return the hidden field defined + */ + private function fieldBulma1hidden(): string + { + $res = ""; + // No $this->label, $this->multiple, $this->readonly, $this->hidden, + // $this->rows $this->cols $this->placeholder $this->maxlength + $res .= "name, ENT_QUOTES) . "]'"; + $res .= " id='$this->formName" . "_"; + $res .= htmlspecialchars($this->name, ENT_QUOTES) . "'"; + if (isset($this->values)) { + $res .= " value='" . htmlspecialchars($this->values) . "'"; + } else { + $res .= " value='" . htmlspecialchars($this->defaults) . "'"; + } + $res .= "/>\n"; + return $res; + } + + /** + * Return the password field defined + */ + private function fieldBulma1password(): string + { + $res = ""; + // No $this->multiple, $this->titles, $this->rows, $this->cols + $res .= "
"; + $res .= htmlspecialchars($this->errors[1]); + $res .= "
\n"; + } + if (isset($this->help)) { + $res .= "name, ENT_QUOTES) . "_help'>"; + $res .= $this->help; + $res .= "
\n"; + } + $res .= ""; + $res .= htmlspecialchars($this->errors[1]); + $res .= "
\n"; + } + if (isset($this->help)) { + $res .= "name, ENT_QUOTES) . "_help'>"; + $res .= $this->help; + $res .= "
\n"; + } + $res .= ""; + $res .= htmlspecialchars($this->errors[1]); + $res .= "
\n"; + } + if (isset($this->help)) { + $res .= "name, ENT_QUOTES) . "_help'>"; + $res .= $this->help; + $res .= "
\n"; + } + $res .= ""; + $res .= htmlspecialchars($this->errors[1]); + $res .= "
\n"; + } + if (isset($this->help)) { + $res .= "name, ENT_QUOTES) . "_help'>"; + $res .= $this->help; + $res .= "
\n"; + } + $res .= ""; + $res .= htmlspecialchars($this->errors[1]); + $res .= "
\n"; + } + if (isset($this->help)) { + $res .= "name, ENT_QUOTES) . "_help'>"; + $res .= $this->help; + $res .= "
\n"; + } + $res .= ""; + $res .= htmlspecialchars($this->errors[1]); + $res .= "
\n"; + } + if (isset($this->help)) { + $res .= "name, ENT_QUOTES) . "_help'>"; + $res .= $this->help; + $res .= "
\n"; + } + $res .= ""; + $res .= htmlspecialchars($this->errors[1]); + $res .= "
\n"; + } + if (isset($this->help)) { + $res .= "name, ENT_QUOTES) . "_help'>"; + $res .= $this->help; + $res .= "
\n"; + } + $res .= "