Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

(no description)

File Size: 258 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

HTML_QuickForm_autocomplete:: (2 methods):
  __construct()
  HTML_QuickForm_autocomplete()

name:: (7 methods):
  setOptions()
  toHtml()
  setSelectionRange()
  setCaretToPosition()
  replaceSelection()
  autocompleteMatch()
  autocomplete()


Class: HTML_QuickForm_autocomplete  - X-Ref

Class to dynamically create an HTML input text element that
at every keypressed javascript event, check in an array of options
if there's a match and autocomplete the text in case of match.

Ex:
$autocomplete =& $form->addElement('autocomplete', 'fruit', 'Favourite fruit:');
$options = array("Apple", "Orange", "Pear", "Strawberry");
$autocomplete->setOptions($options);

__construct($elementName = null, $elementLabel = null, $options = null, $attributes = null)   X-Ref
Class constructor

param: string    $elementName    (optional)Input field name attribute
param: string    $elementLabel   (optional)Input field label in form
param: array     $options        (optional)Autocomplete options
param: mixed     $attributes     (optional)Either a typical HTML attribute string
return: void

HTML_QuickForm_autocomplete($elementName = null, $elementLabel = null, $options = null, $attributes = null)   X-Ref
Old syntax of class constructor. Deprecated in PHP7.


Class: name  - X-Ref

setOptions($options)   X-Ref
Sets the options for the autocomplete input text element

param: array    $options    Array of options for the autocomplete input text element
return: void

toHtml()   X-Ref
Returns Html for the autocomplete input text element

return: string

setSelectionRange(input, selectionStart, selectionEnd)   X-Ref
No description

setCaretToPosition(input, position)   X-Ref
No description

replaceSelection(input, replaceString)   X-Ref
No description

autocompleteMatch(text, values)   X-Ref
No description

autocomplete(textbox, event, values)   X-Ref
No description