form : display the help with the error if both are defined

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2212 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2015-08-06 11:50:05 +00:00
parent 3ae5bcf8c3
commit 0a5d7edfad

View File

@@ -272,6 +272,8 @@ class formfield
$res .= " <div class='col-sm-10'>\n";
if (is_string ($this->defaults))
$this->defaults = array ($this->defaults);
if (count ($this->titles) === 0)
$this->titles = array ("");
foreach ($this->titles as $key=>$val)
{
$res .= "<div class='checkbox'>";
@@ -305,17 +307,13 @@ class formfield
$res .= "</div>\n";
}
if (isset ($this->errors))
if (isset ($this->errors) || isset ($this->help))
{
$res .= " <span class='help-block' id='$this->formName"."_";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>".
$this->errors[1]."</span>\n";
}
elseif (isset ($this->help))
{
$res .= " <span class='help-block' id='$this->formName"."_";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>".$this->help.
"</span>\n";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>";
if (isset ($this->help)) $res .= $this->help."<br/>\n";
if (isset ($this->errors)) $res .= $this->errors[1];
$res .= "</span>\n";
}
$res .= " </div>\n"; // End controls
$res .= " </div>\n"; // End form-group
@@ -387,17 +385,13 @@ class formfield
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'";
}
$res .= "/>\n";
if (isset ($this->errors))
if (isset ($this->errors) || isset ($this->help))
{
$res .= " <span class='help-block' id='$this->formName"."_";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>".
$this->errors[1]."</span>\n";
}
elseif (isset ($this->help))
{
$res .= " <span class='help-block' id='$this->formName"."_";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>".$this->help.
"</span>\n";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>";
if (isset ($this->help)) $res .= $this->help."<br/>\n";
if (isset ($this->errors)) $res .= $this->errors[1];
$res .= "</span>\n";
}
$res .= " </div>\n"; // End controls
$res .= " </div>\n"; // End form-group
@@ -464,17 +458,13 @@ class formfield
$res .= "</div>";
}
if (isset ($this->errors))
if (isset ($this->errors) || isset ($this->help))
{
$res .= " <span class='help-block' id='$this->formName"."_";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>".
$this->errors[1]."</span>\n";
}
elseif (isset ($this->help))
{
$res .= " <span class='help-block' id='$this->formName"."_";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>".$this->help.
"</span>\n";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>";
if (isset ($this->help)) $res .= $this->help."<br/>\n";
if (isset ($this->errors)) $res .= $this->errors[1];
$res .= "</span>\n";
}
$res .= " </div>\n"; // End controls
$res .= " </div>\n"; // End form-group
@@ -568,17 +558,13 @@ class formfield
}
$res .= " </select>\n";
if (isset ($this->errors))
if (isset ($this->errors) || isset ($this->help))
{
$res .= " <span class='help-block' id='$this->formName"."_";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>".
$this->errors[1]."</span>\n";
}
elseif (isset ($this->help))
{
$res .= " <span class='help-block' id='$this->formName"."_";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>".$this->help
."</span>\n";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>";
if (isset ($this->help)) $res .= $this->help."<br/>\n";
if (isset ($this->errors)) $res .= $this->errors[1];
$res .= "</span>\n";
}
}
else
@@ -669,17 +655,13 @@ class formfield
else
$res .= htmlspecialchars ($this->defaults, ENT_QUOTES);
$res .= "</textarea>\n";
if (isset ($this->errors))
if (isset ($this->errors) || isset ($this->help))
{
$res .= " <span class='help-block' id='$this->formName"."_";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>".
$this->errors[1]."</span>\n";
}
elseif (isset ($this->help))
{
$res .= " <span class='help-block' id='$this->formName"."_";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>".$this->help
."</span>\n";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>";
if (isset ($this->help)) $res .= $this->help."<br/>\n";
if (isset ($this->errors)) $res .= $this->errors[1];
$res .= "</span>\n";
}
$res .= " </div>\n"; // End controls
$res .= " </div>\n"; // End form-group
@@ -732,17 +714,13 @@ class formfield
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'";
}
$res .= "/>\n";
if (isset ($this->errors))
if (isset ($this->errors) || isset ($this->help))
{
$res .= " <span class='help-block' id='$this->formName"."_";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>".
$this->errors[1]."</span>\n";
}
elseif (isset ($this->help))
{
$res .= " <span class='help-block' id='$this->formName"."_";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>".$this->help
."</span>\n";
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'>";
if (isset ($this->help)) $res .= $this->help."<br/>\n";
if (isset ($this->errors)) $res .= $this->errors[1];
$res .= "</span>\n";
}
$res .= " </div>\n"; // End controls
$res .= " </div>\n"; // End form-group