// returns an ExtendedElement that is an HTML <img> with the given src and alt attributes (set to '' by default)
//
// public function createElementForm($action, $method, $name)
- // returns an ExtendedElement that is an HTML <div> that is a child of an HTML <form>
- // with the given action, method, and name
+ // returns an ExtendedElement that is an HTML <form> with the given action, method, and name
//
// public function createElementInputHidden($name, $value)
// returns an ExtendedElement that is an HTML <input> of type 'hidden' with the given name and value
public function createElement($name, $value = '') {
// Adding the $value in DOMDocument's createElement does NOT escape it, so override it and use appendText to support that.
$aelem = parent::createElement($name);
- if (strlen($value)) { $aelem->appendText($value); }
+ if (strlen($value ?? '')) { $aelem->appendText($value); }
return $aelem;
}
}
public function createElementInputDate($name, $id = null, $min = null, $max = null, $value = null) {
- $telfield = $this->createElement('input');
- $telfield->setAttribute('type', 'date');
- if (!is_null($id)) { $telfield->setAttribute('id', $id); }
- if (!is_null($min)) { $rgfield->setAttribute('min', $min); }
- if (!is_null($max)) { $rgfield->setAttribute('max', $max); }
- if (!is_null($value)) { $telfield->setAttribute('value', $value); }
- return $telfield;
+ $dtfield = $this->createElement('input');
+ $dtfield->setAttribute('type', 'date');
+ if (!is_null($id)) { $dtfield->setAttribute('id', $id); }
+ $dtfield->setAttribute('name', $name);
+ if (!is_null($min)) { $dtfield->setAttribute('min', $min); }
+ if (!is_null($max)) { $dtfield->setAttribute('max', $max); }
+ if (!is_null($value)) { $dtfield->setAttribute('value', $value); }
+ return $dtfield;
}
public function createElementInputTime($name, $id = null, $min = null, $max = null, $value = null) {
- $telfield = $this->createElement('input');
- $telfield->setAttribute('type', 'time');
- if (!is_null($id)) { $telfield->setAttribute('id', $id); }
- if (!is_null($min)) { $rgfield->setAttribute('min', $min); }
- if (!is_null($max)) { $rgfield->setAttribute('max', $max); }
- if (!is_null($value)) { $telfield->setAttribute('value', $value); }
- return $telfield;
+ $timefield = $this->createElement('input');
+ $timefield->setAttribute('type', 'time');
+ if (!is_null($id)) { $timefield->setAttribute('id', $id); }
+ $timefield->setAttribute('name', $name);
+ if (!is_null($min)) { $timefield->setAttribute('min', $min); }
+ if (!is_null($max)) { $timefield->setAttribute('max', $max); }
+ if (!is_null($value)) { $timefield->setAttribute('value', $value); }
+ return $timefield;
}
public function createElementInputColor($name, $id = null, $value = null) {