11namespace Depage\HtmlForm\Elements;
13use Depage\HtmlForm\Abstracts;
54 parent::setDefaults();
56 $this->defaults[
'defaultValue'] =
false;
68 public function setValue(mixed $newValue): bool
70 if (is_bool($newValue)) {
71 $this->value = $newValue;
72 } elseif ($newValue ===
"true") {
92 $label = $this->htmlLabel();
97 return "<p {$wrapperAttributes}>" .
98 "<button name=\"{$this->name}\" type=\"submit\"{$inputAttributes} value=\"{$value}\">{$label}</button>" .
htmlInputAttributes()
Returns string of HTML attributes for input element.
$value
Input elements's value.
$label
Input element - HTML label.
$errorMessage
Message that gets displayed in case of invalid input.
htmlHelpMessage()
Returns HTML-rendered helpMessage.
htmlWrapperAttributes()
Returns string of HTML attributes for element wrapper paragraph.
htmlMarker()
Returns elements' required-indicator.
$type
Input element type - HTML input type attribute.
$helpMessage
Extra help message.
$marker
Input element - HTML marker text that marks required fields.
htmlErrorMessage()
Returns HTML-rendered error message.
setValue(mixed $newValue)
set the boolean element value
__toString()
Renders element to HTML.
setDefaults()
collects initial values across subclasses