Alien-GvaScript

 view release on metacpan or  search on metacpan

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

    <div class="TN_content">
      <p>When the input field gets focus, the autocompleter starts listening
for key events. As soon as <code>minimumChars</code> have been typed, or if the
user presses the <code>DOWN</code> arrow key, the autocompleter gets a list of
suggestions from the datasource, and displays them in a dropdown list.</p>
<p>The dropdown list can be navigated through arrow keys. Selecting a
suggestion in the list is done either by a click, or by pressing the
<code>RETURN</code> key (this is handled by the
<i>Alien::GvaScript::ChoiceList</i> component of
GvaScript). Then the value of that suggestion fills the input field
value, dependent fields (if any) are updated, and the <code>onLegalValue</code>
event is triggered.</p>
<p>A number of variations on this behaviour may be controlled by the options
described below.</p>

    </div>
  </div>
  <div class="TN_node" id="CONSTRUCTOR">
    <h2 class="TN_label">CONSTRUCTOR</h2>
    <div class="TN_content">
      <pre>  var myAutocompleter = new GvaScript.Autocompleter(datasource, options);</pre>

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

<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
the name of a property to extract from the <code>choice</code> member
that validated the current input. However, the autocompleted field

lib/Alien/GvaScript/AutoCompleter.pod  view on Meta::CPAN

When the input field gets focus, the autocompleter starts listening
for key events. As soon as C<minimumChars> have been typed, or if the
user presses the C<DOWN> arrow key, the autocompleter gets a list of
suggestions from the datasource, and displays them in a dropdown list.

The dropdown list can be navigated through arrow keys. Selecting a
suggestion in the list is done either by a click, or by pressing the
C<RETURN> key (this is handled by the
L<Alien::GvaScript::ChoiceList|choiceList> component of
GvaScript). Then the value of that suggestion fills the input field
value, dependent fields (if any) are updated, and the C<onLegalValue>
event is triggered.

A number of variations on this behaviour may be controlled by the options
described below.


=head1 CONSTRUCTOR

  var myAutocompleter = new GvaScript.Autocompleter(datasource, options);

lib/Alien/GvaScript/AutoCompleter.pod  view on Meta::CPAN

  var ac =  new GvaScript.Autocompleter(url, {
              dependentFields : {
                foo : "firstname",
                bar : "lastname",
                id  : "id"
              } } );

Inline object that specifies dependencies between the field
controlled by the autocompleter, and other fields in the same form.
When leaving the autocompleted field (C<onBlur>), the dependent fields
will be updated automatically. This only works for autocompleters
in strict mode.

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
C<some.very.3.long.2.path>, then the C<foo> entry in
C<dependentFields> will refer to field C<some.very.3.long.2.foo>.


lib/Alien/GvaScript/lib/GvaScript.js  view on Meta::CPAN

          delete tree[i];
        }
      }
    }

    // call Repeat.remove() to remove from DOM
    // and if live_update, to remove and reproduce
    // the blocks below with correct renumerations
    GvaScript.Repeat.remove(repetition_block, live_update);

    // after form tree has been updated
    // and dom re-populated
    if(live_update) {
      // re-populate blocks below
      GvaScript.Form.fill_from_tree(form, repeat_name, tree);
    }

    // check if form has a GvaSCript.Form instance
    // wrapped around it
    if(_gva_form = GvaScript.Forms.get(form.identify())) {
      _gva_form.fire('RepeatBlockRemove', [repeat_name.split('.').last(), repeat_name + '.' + remove_ix]);

src/form.js  view on Meta::CPAN

          delete tree[i];
        }
      }
    }

    // call Repeat.remove() to remove from DOM
    // and if live_update, to remove and reproduce
    // the blocks below with correct renumerations
    GvaScript.Repeat.remove(repetition_block, live_update);

    // after form tree has been updated
    // and dom re-populated
    if(live_update) {
      // re-populate blocks below
      GvaScript.Form.fill_from_tree(form, repeat_name, tree);
    }

    // check if form has a GvaSCript.Form instance
    // wrapped around it
    if(_gva_form = GvaScript.Forms.get(form.identify())) {
      _gva_form.fire('RepeatBlockRemove', [repeat_name.split('.').last(), repeat_name + '.' + remove_ix]);

test/functional/form/form.gvascript.html  view on Meta::CPAN

    onInit: function(gva_form) {
      gva_form.valid = new Validation(gva_form.formElt, {onSubmit:false});
      log('Form <em>[Late]</em> onInit: validation module attached')
    },

    onChange: function(gva_form, event) {
      log('Form <em>[Late]</em> onChange');
      gva_form.formElt.addClassName('form-edited');
      gva_form.formElt.removeClassName('form-error');
      
      setInfoMessage('form updated ... make sure to save.');
    },

    onBeforeSubmit: function(gva_form) {
      log('Form <em>[Late]</em> onBeforeSubmit: hides form message and resets its classnames');
      gva_form.formElt.removeClassName('form-edited');
      gva_form.formElt.removeClassName('form-error');
      hideMessage();
    },

    onAfterSubmit: function(gva_form) {

test/unit/customButtons.html  view on Meta::CPAN

                    id: 'hidden_button',
                    label: 'hidden',
                    condition: false
                }
            ]});

            assertInstanceOf(GvaScript.CustomButtons.ActionsBar, ab, 'ActionsBar component has not been properly initialized!');
            assert($('actions_bar').hasClassName('gva-actionsbar'), 'ActionsBar did not set the default classname'); 
        }},
        
        // wait a second to make sure that DOM is updated
        // test that the buttons has been rendered properly
        testButtons: function() { with(this) {
            wait(1000, function() { with(this) {
                assertEqual(3, $('actions_bar').select('button').length, 'Failed to render 3 buttons');
                         
                assertEqual(1, $('actions_bar').select('button[type="submit"]').length, 'Failed to render type submit buttons');
                assertEqual(1, $('actions_bar').select('button[type="reset"]').length, 'Failed to render type reset buttons');

                assertVisible('actions_bar_btn_0', 'Failed to set generic id');
                assertVisible('actions_bar_btn_1', 'Failed to set generic id');



( run in 0.269 second using v1.01-cache-2.11-cpan-05444aca049 )