Alien-GvaScript

 view release on metacpan or  search on metacpan

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

  </div>
  <div class="TN_node" id="EVENTS">
    <h2 class="TN_label">EVENTS</h2>
    <div class="TN_content">
      <p>For a general explanation on registering handlers
for GvaScript events, see the <i>event</i> documentation.
In short, you can register handlers either on the 
HTML input element, as in</p>
<pre>  &lt;input name="someInput" onfocus = "myAutoCompleter.complete(this)"
                          onBind  = "bindHandler(this, event)"
                          onLeave = "leaveHandler"&gt;</pre>

<p>or on the javascript object, as in</p>
<pre>   myAutocompleter.onBind = function(event) {
        bindHandler(event.target, event)
   };
   myAutocompleter.onLeave = leaveHandler;</pre>

<p>Below is the list of events generated by
autocompleter objects.</p>
  <div class="TN_node" id="onBind">
    <h3 class="TN_label">onBind</h3>
    <div class="TN_content">
      <p>This event is triggered whenever the autocompleter object 
becomes associated with an input field; typically this
occurs when the input field receives focus and then
calls the <a href="#autocomplete">/"autocomplete"</a> method.</p>

    </div>
  </div>
  <div class="TN_node" id="onLeave">
    <h3 class="TN_label">onLeave</h3>
    <div class="TN_content">
      <p>This event is triggered whenever the autocompleter object 
cuts the association with an input field; typically this
occurs when the input field loses focus.</p>
<p>If in strict mode, the autocompleter object will also
check if the final value is legal or illegal with respect
to the list of available choices. This may require an
additional Ajax call, so the <code>onLeave</code> event may be
triggered <i>before</i> the <code>onLegalValue</code> or <code>onIllegalValue</code> events.</p>

    </div>
  </div>
  <div class="TN_node" id="onComplete">
    <h3 class="TN_label">onComplete</h3>
    <div class="TN_content">
      <p>[OBSOLETE; use <code>onLegalValue</code> or <code>onIllegalValue</code> instead]</p>
<p>This event is triggered whenever the user has chosen
an item in the displayed suggestion list.
The event handler may use <code>event.index</code> to know the index of the
selected choice.</p>

    </div>
  </div>
  <div class="TN_node" id="onLegalValue">
    <h3 class="TN_label">onLegalValue</h3>
    <div class="TN_content">
      <p>This event is triggered when the autocompleter is in strict mode,
the input field has just been left (<code>onBlur</code> event), and the 
autocompleter was able to verify that the current input value
belongs to the list of available choices.</p>
<p>The event contains a <code>value</code> property (current value in the 
input element), and a <code>choice</code> property (member of the 
<code>choices</code> array that matches the current value).
The <code>controller</code> property is null because the event may
occur after the autocompleter object has been detached from the input
field and has been perhaps already bound to another field, so interacting 
with the autocompleter from the event handler would lead to inconsistencies.</p>

    </div>
  </div>
  <div class="TN_node" id="onIllegalValue">
    <h3 class="TN_label">onIllegalValue</h3>
    <div class="TN_content">
      <p>This event is triggered when the autocompleter is in strict mode,
the input field has just been left (<code>onBlur</code> event), and the 
autocompleter was not able to verify that the current input value
belongs to the list of available choices.</p>
<p>The event only contains a <code>value</code> property (current value in the 
input element). The <code>controller</code> property is null (same reasons
as <code>onLegalValue</code> above).</p>
<p>return <code>true</code> in onIllegalValue handler to override the illegal behavior; i.e. coloring the 
input in red and invalidating the dependentFields.</p>

    </div>
  </div>
  <div class="TN_node" id="onHighlight">
    <h3 class="TN_label">onHighlight</h3>
    <div class="TN_content">
      <p>This event is triggered when a choice in the dropdown list
of choices is highlighted.
The event handler may use <code>event.index</code> to know the index of the
highlighted choice.</p>

    </div>
  </div>
  <div class="TN_node" id="onCancel">
    <h3 class="TN_label">onCancel</h3>
    <div class="TN_content">
      <p>This event is triggered when the user presses the <code>ESCAPE</code> key.</p>

    </div>
  </div>

    </div>
  </div>

</div>
</body>
</html>



( run in 0.996 second using v1.01-cache-2.11-cpan-385001e3568 )