AutoComplete allows you to have an autocomplete field for any arbitrary data source. Based on jQuery-Autocomplete

public PHPFUI\Base::DEBUG_SOURCE = 1
public PHPFUI\HTML5Element::__clone()
public __construct(PHPFUI\Page $page, callable $callback, string $type, string $name, ?string $label = NULL, ?string $value = NULL)
Construct a AutoComplete.

Required callback behavior:

The callback function must take an array and returns an array.

Input Array:

If the input array contains an index named 'save' then the user has indicated they have selected text value passed in the 'AutoComplete' index. This generally means you should set the value of the hidden field (set / getHiddenField) to the value of 'AutoComplete'. If save is not set, you must return matches for the text in 'AutoComplete' in the format descriped below.

Return Array:

Has one index 'suggestions' that contains an array of matches in the form of ['value' => 'Text to display', 'data' => 123]. If 'save' is specified, the 'suggestions' value should be an empty array.

    public PHPFUI\Base::__toString() : string
    public PHPFUI\Base::add( $item)
    Base add function. Adds to the end of the current objects

    • return Base
    public PHPFUI\Base::addAsFirst( $item)
    Base addAsFirst function. Adds to the front of the current object

    • return Base
    public PHPFUI\HTML5Element::addAttribute(string $attribute, string $value = '') : PHPFUI\HTML5Element
    Add an attribute the the object

      public addAutoCompleteOption(string $option, string $value) : PHPFUI\Input\AutoComplete
      Add an option for jQuery-Autocomplete.

      public PHPFUI\HTML5Element::addClass(string $class) : PHPFUI\HTML5Element
      Add a class to an object

        public PHPFUI\Input\Input::addErrorMessage(string $error) : PHPFUI\Input\Input
        Set a specific error

          public PHPFUI\Base::count() : int
          Number of object in this object. Does not count sub objects.

          public PHPFUI\HTML5Element::deleteAttribute(string $attribute) : PHPFUI\HTML5Element
          Deletes the passed attribute

          public PHPFUI\HTML5Element::deleteAttributes() : PHPFUI\HTML5Element
          Deletes all attributes

          public PHPFUI\HTML5Element::deleteClass(string $classToDelete) : PHPFUI\HTML5Element
          Delete a class from the object

          public PHPFUI\HTML5Element::disabled() : PHPFUI\HTML5Element
          Disabled the element

          public PHPFUI\Base::done(bool $done = true) : PHPFUI\Base
          Form is done rendering

          public PHPFUI\HTML5Element::getAttribute(string $attribute) : string
          Get an attribute

          • return ?string does not exist if null
          public PHPFUI\HTML5Element::getAttributes() : string
          Returns the attribute strings. Attributes with values are returned as name/value pairs, attributes without values are returned as just the attribute name.

          public PHPFUI\HTML5Element::getClass() : string
          Returns the class attribute ready for insertion into an element.

          public PHPFUI\HTML5Element::getClasses() : array
          Returns all classes for the object

          public static PHPFUI\Base::getDebug(int $flags = 0) : int
          Gets the current debug setting

          public PHPFUI\Input::getDisabled() : bool
          Return true if disabled

          public PHPFUI\HTML5Element::getElement() : string
          Return the type of the element

          public PHPFUI\Input\Input::getError() : PHPFUI\HTML5Element
          Get the error message for placement else where. If this is called, the error mesage will not be incorporated automatically, but must be placed by the caller

          public getHiddenField() : PHPFUI\Input\Hidden
          Returns the hidden field which is where the autocompleted value will be stored. The hidden field name is the same name as the AutoComplete field was constructed with. This should generally be used to save the value the user has selected when 'save' is passed to the callback.

          public PHPFUI\Input\Input::getHint() : PHPFUI\HTML5Element
          public PHPFUI\HTML5Element::getId() : string
          Return the id of the object. Elements will not have an id unless this method is called. The id is returned as a string starting with id followed by a unique number to the page. Id numbers are deterministic and start start with 1. Once assigned an id, an element will always have the same id. It will get a new id if cloned.

          public PHPFUI\HTML5Element::getIdAttribute() : string
          Return the id attribute of the object as a name/value pair. If no id has been requested, and empty string is returned.

          public PHPFUI\Input\Input::getLabel() : string
          Return the label for the input field

          public PHPFUI\Input::getName() : string
          Returns the name of the input field

          public PHPFUI\Input::getPlaceholder() : string
          Returns the current placeholder

          public PHPFUI\Base::getResponse() : string
          Get the current response

          public PHPFUI\HTML5Element::getToolTip(string $label)
          Get the tool tip as a string

          • return ToolTip|string return type depends on if the tip was set as a string or ToolTip object.
          public PHPFUI\Input::getType() : string
          Returns the type of the input field

          public PHPFUI\Input::getValue() : string
          Return the initial value of the input field

          public PHPFUI\HTML5Element::hasClass(string $class) : bool
          Return true if the class is present on the object

          public PHPFUI\HTML5Element::hasId() : bool
          Does this object have an id set already?

          public PHPFUI\HTML5Element::hasToolTip() : bool

          • return bool if there is a tool tip associated with this element
          public inReveal(bool $isInRevealModal = true) : PHPFUI\Input\AutoComplete
          Called recursively by Reveal to force fixed postion autocomplete hints.

          public PHPFUI\Base::isDone() : bool
          Returns true if the page needs no more processing

          public PHPFUI\HTML5Element::newId() : PHPFUI\HTML5Element
          Assign a new id to this element.

          public PHPFUI\Base::output() : string
          Output the object (convert to string)

          • return string
          public PHPFUI\Base::prepend( $item) : PHPFUI\Base
          Add an object in front of existing object

          public removeAutoCompleteOption(string $option) : PHPFUI\Input\AutoComplete
          Remove an option for jQuery-Autocomplete.

          public PHPFUI\HTML5Element::setAttribute(string $attribute, string $value = '') : PHPFUI\HTML5Element
          Set the attribute overwriting the prior value

            public PHPFUI\HTML5Element::setConfirm( $text) : PHPFUI\HTML5Element
            A simple way to set a confirm on click

              public PHPFUI\Input\Input::setDataMask(PHPFUI\Page $page, string $mask) : PHPFUI\Input\Input
              public static PHPFUI\Base::setDebug(int $level = 0) : void
              Set the debug level, 1 or higher is on

              public PHPFUI\Input::setDisabled(bool $disabled = true) : PHPFUI\Input
              Set disabled

              public PHPFUI\HTML5Element::setElement( $element) : PHPFUI\HTML5Element
              You can set the element type if you need to morph it for some reason

                public PHPFUI\Input\Input::setHint(string $hint) : PHPFUI\Input\Input
                Set a hint

                  public PHPFUI\HTML5Element::setId( $id) : PHPFUI\HTML5Element
                  Set the base id of the object

                    public PHPFUI\Input\Input::setLabel(string $label) : PHPFUI\Input\Input
                    Set a label if not specified in constructor

                    public setNoFreeForm(bool $on = true) : PHPFUI\Input\AutoComplete
                    If No Free Form is turned on, then the user can only pick suggested values. It is off by default allowing the user to specify any text and not just suggestions.

                    public PHPFUI\Input::setPlaceholder(string $placeholder) : PHPFUI\Input
                    public PHPFUI\Base::setRawResponse(string $response) : PHPFUI\Base
                    Sets the page response directly

                    public PHPFUI\Input\Input::setRequired(bool $required = true) : PHPFUI\Input\Input
                    Set required

                      public PHPFUI\Base::setResponse(string $response, string $color = 'lime') : PHPFUI\Base
                      Set a response in the standard format ('reponse' and 'color' array)

                        public PHPFUI\HTML5Element::setToolTip( $tip) : PHPFUI\HTML5Element
                        Set the tool tip. Can either be a ToolTip or a string. If it is a string, it will be converted to a ToolTip

                          public PHPFUI\Input::setValue( $value) : PHPFUI\Input
                          Set the initial value of the input field

                            public PHPFUI\HTML5Element::toggleAnimate(PHPFUI\HTML5Element $element, string $animation) : PHPFUI\HTML5Element
                            Will toggle the provided element on click with the provided animation.

                            public PHPFUI\HTML5Element::toggleClass(PHPFUI\HTML5Element $element, string $class) : PHPFUI\HTML5Element
                            Will toggle the class on the provided element on click.

                            public PHPFUI\Input\Input::toggleFocus(PHPFUI\HTML5Element $element) : PHPFUI\Input\Input
                            Toggle the passed in element when this field gets focus.

                            public PHPFUI\HTML5Element::transferAttributes(PHPFUI\HTML5Element $from) : PHPFUI\HTML5Element
                            Moves attributes into this object from the passed object

                            public PHPFUI\HTML5Element::transferClasses(PHPFUI\HTML5Element $from) : PHPFUI\HTML5Element
                            Moves classes into this object from the passed object

                            public PHPFUI\Base::walk(string $method) : PHPFUI\Base
                            Recursively walks all objects and calls the passed method on each object where it exists

                            protected $callback
                            protected $className
                            protected PHPFUI\Input::$disabled
                            protected PHPFUI\Input\Input::$error
                            protected PHPFUI\Input\Input::$errorMessages
                            protected $hidden
                            protected PHPFUI\Input\Input::$hint
                            protected PHPFUI\Input\Input::$hintText
                            protected PHPFUI\Input\Input::$label
                            protected PHPFUI\Input::$name
                            protected $noFreeForm
                            protected $options
                            protected $page
                            protected PHPFUI\Input::$placeholder
                            protected PHPFUI\Input\Input::$required
                            protected PHPFUI\Input::$type
                            protected PHPFUI\Input::$value
                            protected PHPFUI\HTML5Element::getBody() : string
                            protected getEnd() : string
                            protected getStart() : string
                            protected PHPFUI\Input\Input::setAutoCompleteRequired(PHPFUI\Page $page, PHPFUI\Input\Input $text) : void
                            protected PHPFUI\HTML5Element::upCastCopy(PHPFUI\HTML5Element $to, PHPFUI\HTML5Element $from) : PHPFUI\HTML5Element
                            Clones the first object and fills it with properties from the second object

                            public static PHPFUI\Base::getDebug(int $flags = 0) : int
                            Gets the current debug setting

                            public static PHPFUI\Base::setDebug(int $level = 0) : void
                            Set the debug level, 1 or higher is on

                            © 2020 Bruce Wells
                            Search Namespaces \ Classes
                            ConfigurationNumbers (0-9.) only