Alien-GvaScript

 view release on metacpan or  search on metacpan

doc/html/AutoCompleter.html  view on Meta::CPAN

<p>this object is supposed to have a <code>label</code> property and a 
<code>value</code> property. Actually, these are the default names for
the properties; they can be changed in the constructor options.</p>
<p>The <code>label</code> property may contain rich HTML, i.e. including
formatting tags.</p>
</li>
</ul>

    </div>
  </div>

    </div>
  </div>
  <div class="TN_node" id="Options">
    <h3 class="TN_label">Options</h3>
    <div class="TN_content">
      <p>The options to construct an autocompleter object are :</p>
<ul>
<li><a name="item_minimumChars"></a><b>minimumChars</b>
<p>How many characters are needed before trying to find suggestions.</p>
</li>
<li><a name="item_labelField"></a><b>labelField</b>
<p>Name of the field that contains the HTML to display
(default is <code>label</code>).</p>
</li>
<li><a name="item_valueField"></a><b>valueField</b>
<p>Name of the field that contains the value to put in input element
(default is <code>value</code>).</p>
</li>
<li><a name="item_autoSuggest"></a><b>autoSuggest</b>
<p>Boolean value; toggles whether suggestions are displayed automatically
when available (true by default). If false, suggestions are only
displayed when the <code>ARROW_DOWN</code> key is pressed.</p>
</li>
<li><a name="item_autoSuggestDelay"></a><b>autoSuggestDelay</b>
<p>How many milliseconds to wait after a keypress before displaying 
suggestions. Default is 200.</p>
</li>
<li><a name="item_typeAhead"></a><b>typeAhead</b>
<p>If true (the default), the current suggestion will be automatically 
inserted into the input element.</p>
</li>
<li><a name="item_maxHeight"></a><b>maxHeight</b>
<p>Maximum height for the suggestion DIV (in pixels).
Default is 200.</p>
</li>
<li><a name="item_minWidth"></a><b>minWidth</b>
<p>Minimum width for the suggestion DIV (in pixels)
Default is 200.</p>
</li>
<li><a name="item_offsetX"></a><b>offsetX</b>
<p>Offset (in pixels) from the left border of the 
input element to the left border of the 
suggestion DIV.
Default is 0.</p>
</li>
<li><a name="item_strict"></a><b>strict</b>
<p>If this option is true and the user 
leaves the field with an illegal value
(not in the suggestion list), 
the field is marked with a red background.
Default is false.</p>
</li>
<li><a name="item_blankOK"></a><b>blankOK</b>
<p>If this option is defined and false, 
the field is marked with a red background
when left with an empty value.
Default is true.</p>
</li>
<li><a name="item_ignorePrefix"></a><b>ignorePrefix</b>
<p>If true, and if the datasource is a Javascript array, then
that whole array is always displayed as suggestions, 
whatever may be typed in the input field (so the field
behaves more or less like a SELECT).
Default is false.</p>
</li>
<li><a name="item_caseSensitive"></a><b>caseSensitive</b>
<p>This option only applies if the datasource is a Javascript array
and if <code>ignorePrefix</code> is false.
If true (the default), filtering of the datasource array 
from the current value of the input field
will be case-sensitive.</p>
</li>
<li><a name="item_colorIllegal"></a><b>colorIllegal</b>
<p>Which color to put in the background when a "strict" field contains 
an illegal value (default is red).</p>
</li>
<li><a name="item_scrollCount"></a><b>scrollCount</b>
<p>How many items to skip when hitting the 
<code>PAGE_UP</code> or <code>PAGE_DOWN</code> keys. 
Default is 5</p>
</li>
<li><a name="item_htmlWrapper"></a><b>htmlWrapper</b>
<p>See the <code>ChoiceList</code> documentation.</p>
</li>
<li><a name="item_choiceItemTagName"></a><b>choiceItemTagName</b>
<p>See the <code>ChoiceList</code> documentation.</p>
</li>
<li><a name="item_classes"></a><b>classes</b>
<p>Classes that will be assigned at various stages
to autocompleter DOM elements .
Possible classes are</p>
<ul>
<li><a name="item_loading"></a><b>loading</b>
<p>Class added to the  input or textarea field while an Ajax
request is pending. Default is <code>AC_loading</code>, a class that displays
an Ajax-loading icon.</p>
</li>
<li><a name="item_dropdown"></a><b>dropdown</b>
<p>Class for the dropdown div that displays the autocompletion choices.
Default is <code>AC_dropdown</code>.</p>
</li>
<li><a name="item_message"></a><b>message</b>
<p>Class for displaying warning messages.
Default is <code>AC_message</code>.</p>
</li>
</ul>
</li>
<li><a name="item_additional_params"></a><b>additional_params</b>
<p>Other parameters to be added in the Ajax query for autocompletion.
Can be either an array or an already encoded string (see <code>Ajax.Options</code> in
<code>prototype.js</code>).
[TODO: should be camelCase to be consistent with other options; 
check dependencies in DMWeb].</p>
</li>
<li><a name="item_dependentFields"></a><b>dependentFields</b>
<pre>  var ac =  new GvaScript.Autocompleter(url, {
              dependentFields : {
                foo : "firstname",
                bar : "lastname",
                id  : "id"
              } } );</pre>

<p>Inline object that specifies dependencies between the field
controlled by the autocompleter, and other fields in the same form.
When leaving the autocompleted field (<code>onBlur</code>), the dependent fields
will be updated automatically. This only works for autocompleters
in strict mode.</p>
<p>Each key in the inline object specifies the name of a field related
to the autocompleted field. If field names are in dotted notation, 
then the related field is taken as a path relative to the autocompleted
field : so for example if the autocompleted field has name
<code>some.very.3.long.2.path</code>, then the <code>foo</code> entry in
<code>dependentFields</code> will refer to field <code>some.very.3.long.2.foo</code>.</p>
<p>The corresponding value (in our example above: <code>firstname</code>) is



( run in 0.532 second using v1.01-cache-2.11-cpan-0d23b851a93 )