View Source

h2. Form API

The Form APIs allow developers access to the specialized types of form submission (e.g. partial, full, single) and processing (clear, reset) provided by ICEfaces.

The following Form APIs are available:

* *{{[ice.ace.clearForm(form)|#clearForm]}}*
* *{{[ice.ace.resetForm(form)|#resetForm]}}*
* *{{[ice.se(event, element) _and_ ice.ser(event, element)|#se]}}*
* *{{[ice.submit(event, element) _or_ ice.s(event, element)|#submit]}}*


----
\\
{anchor:clearForm}
{panel}
h4. ice.ace.clearForm(form)

Accepts a form element ID or the form node itself. By calling this function, all ACE, MOBI and standard components in the form will have their values cleared. This means that text entry components will simply contain the empty string; radio controls and checkboxes will be unchecked; selection components will return to an unselected state; ace:dateTimeEntry will have its date selection removed, if any; ace:fileEntry will return to a state where no file has been specified; ace:sliderEntry will be set to its minimum value; and mobi:flipswitch will be set to off. Note that for mobi:dateSpinner and mobi:timeSpinner, the values in the text boxes will be cleared but the values in the spinner controls will be left where they were.

{tip}Note that the namespace for this function is _ice.ace_.{tip}

_Usage:_

{code:javascript}ice.ace.clearForm(form);
{code}
{_}Parameters:_

* form
bq. The ID of the form or the form node itself
{panel}
\\
{anchor:resetForm}
{panel}
h4. ice.ace.resetForm(form)

Accepts a form element ID or the form node itself. By calling this function, all ACE and MOBI components in the form will have their values reverted to the values they had when they were first loaded on the page. Standard components will have their values reset, as when calling the native reset() function, which simply sets the components to the value that is hard-coded in the markup. If the markup changes or is updated, the reset value might change as well for these components.

{tip}Note that the namespace for this function is _ice.ace_.{tip}

_Usage:_

{code:javascript}ice.ace.resetForm(form);
{code}
{_}Parameters:_

* form
bq. The ID of the form or the form node itself
{panel}
\\
{anchor:se}
{panel}
h4. ice.se(event, element) _and_ ice.ser(event, element)

These functions submit a single element rather than all the elements of the form. This kind of submission reduces the elements serialization overhead and also increases the communication efficiency with the server.

_Usage:_

ice.se sends _javax.faces.partial.execute=@this_ and _javax.faces.partial.render=@all_ along with the serialized element and event.
{code:javascript}ice.se(myEvent, theSubmittingElement);
{code}
ice.ser sends _javax.faces.partial.execute=@this_ and _javax.faces.partial.render=@this_ along with the serialized element and event.
{code:javascript}ice.ser(myEvent, theSubmittingElement);
{code}
{_}Parameters:_

* event




bq. The event captured by the event handler.\* element



bq. The element owning the event handler.
{panel}
\\
{anchor:submit}
{panel}
h4. ice.submit(event, element) _or_ ice.s(event, element)

This is the full submit function that behaves much like a traditional form submission where all form items are posted to the request.

_Usage:_


ice.s sends _javax.faces.partial.execute=@all_ and _javax.faces.partial.render=@all_ along with the serialized elements and event.
{code:javascript}ice.submit(myEvent, theSubmittingElement);
{code}
{_}Parameters:_

* event




bq. The event captured by the event handler.\* element



bq. The element owning the event handler.
{panel}
\\