-
Notifications
You must be signed in to change notification settings - Fork 35
icms_ipf_form_elements_Autocomplete
Raimondas Rimkevičius edited this page Mar 9, 2020
·
1 revision
Notice: Wiki was automatic generated from project sources as project API documentation. Do not edit manually!
To make the Autocomplete field work, the include file needs to look like the following (in this example the Autocomplete field would use the conf_name field of the config table as a lookup):
icms::$logger->disableLogger(); $sql = "SELECT * FROM " . icms::$xoopsDB->prefix("config") . " WHERE conf_name LIKE '%" . $_GET['term'] . "%'"; $result = icms::$xoopsDB->query($sql); while ($myrow = icms::$xoopsDB->fetchArray($result)) $ret[] = array("item" => $myrow["conf_name"]); echo $_GET["callback"] . "(" . json_encode($ret) . ")";
Important:
- use control parameter "file" to specify the include file for the autocomplete
- the include file must be specified without ICMS_URL or ICMS_ROOT_PATH
- if the include file does not exist, the form field is displayed as a text field
- use control parameter "minlength" to specify the minimum amount of characters before the autocomplete function starts to work (default: 3)
- use control parameter "delay" to specify the delay before the autocomplete function starts to work. Use with caution since it can result in high server load! (default: 500)
- Class name: icms_ipf_form_elements_Autocomplete
- Namespace:
- Parent class: icms_form_elements_Text
private mixed $_file
- Visibility: private
private int $_size
Size
- Visibility: private
private int $_maxlength
Maximum length of the text
- Visibility: private
private string $_value
Initial text
- Visibility: private
public bool $autocomplete = \false
Turns off the browser autocomplete function.
- Visibility: public
mixed icms_form_elements_Text::__construct(string caption, string name, int size, int maxlength, string value, mixed autocomplete)
Constructor
- Visibility: public
- This method is defined by icms_form_elements_Text
- caption string - <p>Caption</p>
- name string - <p>"name" attribute</p>
- size int - <p>Size</p>
- maxlength int - <p>Maximum length of text</p>
- value string - <p>Initial text</p>
- autocomplete mixed
string icms_form_elements_Text::render()
Prepare HTML for output
- Visibility: public
- This method is defined by icms_form_elements_Text
int icms_form_elements_Text::getSize()
Get size
- Visibility: public
- This method is defined by icms_form_elements_Text
int icms_form_elements_Text::getMaxlength()
Get maximum text length
- Visibility: public
- This method is defined by icms_form_elements_Text
string icms_form_elements_Text::getValue(bool encode)
Get initial content
- Visibility: public
- This method is defined by icms_form_elements_Text
- encode bool - <p>To sanitizer the text? Default value should be "true"; however we have to set "false" for backward compat</p>
mixed icms_form_elements_Text::setValue(value)
Set initial text value
- Visibility: public
- This method is defined by icms_form_elements_Text
- value mixed - <p>string</p>