Placeholder – PHP Autocomplete https://phpautocomplete.com The Ultimate PHP Dropdown Thu, 09 Feb 2023 22:24:41 +0000 en-US hourly 1 https://wordpress.org/?v=7.0.4 set_placeholder() https://phpautocomplete.com/docs/set_placeholder/ Fri, 14 Feb 2014 17:51:13 +0000 http://phpautocomplete.com/?p=143 Initial value selected if no other selection is made.

Signature:

public function set_placeholder(string $placeholder = ' ', bool $allowClear = true)

Parameters:

  • $placeholder: Placeholder text, e.g. “Please make a selection:”
  • $allowClear: Whether to display a clear button “x” to clear the select box back to the placeholder value once a selection is made.
]]>
Placeholder Text https://phpautocomplete.com/examples/placeholder-text/ Tue, 04 Feb 2014 00:07:00 +0000 http://phpautocomplete.com/?p=76 A placeholder is the displaying text when no value has not set. Simply call set_placeholder() method to set the placeholder text. When placeholder is used for a non-multi-value select box, it requires that you include an empty <option></option> tag as your first option.

Optionally, a clear button (visible once a selection is made) is available to reset the select box back to the placeholder value.

<?php
$pac = new C_PhpAutocomplete('country', $data);
$pac -> set_placeholder('Choose a country name:');
$pac -> display();
?>
<input type="hidden" id="country">
]]>