Add placeholder attribute to search form

A placeholder attribute has been added to the input type search in typesearch.php. This attribute allows a short hint, a word or a short phrase, to be displayed in the input field before the user enters a value. The change was made to enhance the user experience by providing contextual help in the search field.
This commit is contained in:
stephan.kasdorf
2024-03-12 10:36:03 +01:00
parent c7f89194ea
commit a7ce13334c

View File

@@ -13,7 +13,8 @@ class TypeSearch extends FormAttributes implements IForm
{ {
private $_attributes = array( private $_attributes = array(
self::FORM_ATTRIBUTE_CLASS => '', self::FORM_ATTRIBUTE_CLASS => '',
self::FORM_ATTRIBUTE_ID => '' self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_PLACEHOLDER => ''
); );
public function loadElement( $attributes ) public function loadElement( $attributes )
@@ -29,7 +30,7 @@ class TypeSearch extends FormAttributes implements IForm
*/ */
private function _setElement( ) private function _setElement( )
{ {
$this->_element = '<input type="search" ID CLASS>' . "\n"; $this->_element = '<input type="search" placeholder="PLACEHOLDER" ID CLASS>' . "\n";
} }