| pax.widget.autocomplete.init = function( | displayField, | | args | ) |
|
Initialises an autocomplete widget
Parameters
| displayField | the field we display the value in |
| args | arguments for the autocomplete widget |
- url - URL to submit the auto completer requests to.
- searchDelay - Time in ms to delay the search, default is 500ms
- minSearchLength - Minimum chars to input before searching, default is 1
- valueField - Optionally you can choose a seperate field to store the data in. By default this is the same as the displayField
- useIndex - Use the index value rather than the displayed value (like a select dropdown), usually used in conjunction with a hidden displayField; default is false
- resultMaxLength - Maximum number of results to display, default is 0 = no maximum
- resultCharWidth - Length of each string to display from the result, default is 20
- selectResult - Select the non-matching part of the text, for typing over, default is true
- selectFirstMatch - Automatically selects the first match from the result set, default is true
Returns
nothing
Example
Autocomplete widget example: start by typing 'la' in the box below:
<form name='pAutoCompForm' onsubmit='return false;'>
<span>
<input name="town" id="town">
</span>
</form>
This example uses a static php file, with a random selection of 300 Australian town names from NSW.
It will show an autocomplete widget where you can quickly find town names:
[:.
pax.widget.autocomplete.init( pax.$('town'), '/pax/documentation/pax.widget.autocomplete.example.php' );
exampleCleanup = function() {
pax.widget.autocomplete.hideMessageBox( 'town_icon' );
};
:]