autocomplete_htmlFormWidget

Extends \jelix\forms\HtmlWidget\WidgetBase

Widget allowing to select a value by showing results from a search after the user starts to type a name. The search is made into a select html element filled by the datasource of the control, which should be a menulist.

See jAutocomplete jqueryui plugin, which is base on the autocomplete plugin.

If the select box may contain hundred values, prefer to use the autocompleteajax_html widget.

The widget accepts a specific attribute, 'attr-autocomplete', an array which should contains at least an item 'source' indicating the url of the search engine. The array may contains other attributes for the input element used to type the search term (class, style..).

example of use:

In the form file:

    <menulist ref="mylist"> <label>test</label>
    <datasource dao="mymodule~mydao"/>
    </menulist>

In a template:

{form $form, $submitAction, $submitParam, 'html', array('plugins'=>array(
     'mylist'=>'autocomplete_html'))}

{formcontrols}
   ... {ifctrl 'mylist'}{ctrl_control '', array(
         'attr-autocomplete'=>array('style'=>'width:40em;')}
       {else}{ctrl_control}{/ifctrl}
{/formcontrols}
package

Default

Methods

__construct

__construct( $args) 
inherited

Arguments

$args

_outputAttr

_outputAttr( &$attributes) 
inherited

Arguments

$attributes

commonGetJsConstraints

commonGetJsConstraints() 
inherited

commonJs

commonJs() 
inherited

escJsStr

escJsStr( $str) 
inherited

Arguments

$str

fillSelect

fillSelect( $ctrl,  $value) 
inherited

Arguments

$ctrl

$value

Returns an array containing all the control attributes.

getControlAttributes() 
inherited

Get the control class.

getCSSClass() 
inherited

Get the control id.

getId() 
inherited

Retrieve the label attributes.

getLabelAttributes(mixed $editMode) 
inherited

Arguments

$editMode

mixed

Get the control name.

getName() 
inherited

return the value of the HTML element.

getValue() 
inherited

getValueAttributes

getValueAttributes() 
inherited

displays the form field itself.

outputControl() 
inherited abstract

displays the value of the form field only.

outputControlValue() 
inherited

This function displays the blue question mark near the form field.

outputHelp() 
inherited

outputJs

outputJs() 

This function displays the form field label.

outputLabel(mixed $format = '', mixed $editMode = true) 
inherited

Arguments

$format

mixed

$editMode

mixed

outputLabelAsFormLabel

outputLabelAsFormLabel( $label,  $attr) 
inherited

Arguments

$label

$attr

outputLabelAsTitle

outputLabelAsTitle( $label,  $attr) 
inherited

Arguments

$label

$attr

add the CSS and javascript link.

outputMetaContent(\jResponseHtml $resp) 
inherited

Arguments

$resp

\jResponseHtml

The response used

set attributes to add on the HTML element.

setAttributes( $attr) 
inherited

Arguments

$attr

setDefaultAttributes

setDefaultAttributes( $attr) 
inherited

Arguments

$attr

setLabelAttributes

setLabelAttributes( $attributes) 
inherited

Arguments

$attributes

Properties

The form builder.

builder : \jelix\forms\Builder\HtmlBuilder
inherited

the parent widget.

parentWidget : \jelix\forms\HtmlWidget\ParentWidgetInterface
inherited

The control.

ctrl : \jFormsControl
inherited
var

Type(s)

\jFormsControl

default html attributes for the control.

defaultAttributes : array
inherited
var

Type(s)

array

html attributes for the control.

attributes : array
inherited
var

Type(s)

array

html attributes for the control label.

labelAttributes : array
inherited
var

Type(s)

array

valuesSeparator

valuesSeparator : 
inherited

Type(s)

_endt

_endt : 
inherited

Type(s)