TOC PREV NEXT INDEX

Partial Submit - Intelligent Form Processing


ICEfaces introduces a fine-grained user interaction model for intelligent form processing within an ICEfaces application. In JSF, the normal submit mechanism initiates the JSF application lifecycle, and as such, capabilities like client-side validation are not supported. Partial submit overcomes these limitations by tying the JavaScript event mechanism back into the JSF application lifecycle via an automatic submit. This automatic submit is partial in the sense that only partial validation of the form will occur.

The Ajax bridge does intelligent focus monitoring to identify the control associated with the partial submit, and turns off the required property for all other controls in the form. From here, a normal JSF lifecycle is performed, after which the required properties are restored to their previous state. The net effect of a partial submit is that the full validation process executes, but empty fields in the form are not flagged as invalid. Figure 9 illustrates partial submit based on an onBlur JavaScript event that occurs as the user tabs between controls in a form.

The client-side Ajax bridge provides a convenience function for tying JavaScript events to the partial submit mechanism. The API details can be found in JavaScript API Reference, but the mechanism relies on only a small snippet of JavaScript being defined in the specific JavaScript attribute for the JSF component instance that is intended to cause the partial submit.

The granularity at which partial submits occur is entirely under developer control. In certain cases, it may be appropriate to evaluate and react to user input on a per-keystroke-basis, and in other cases, it may be appropriate as focus moves between controls. In still other cases, only specific controls in the form would initiate a partial submit.

Figure 9 Partial Submit Based on OnBlur



The backing application logic associated with a partial submit is also entirely under developer control. The standard JSF validator mechanism can be leveraged, or any other arbitrarily complex or simple evaluation logic can be applied. If standard JSF validators are used, it is important to design these validators to facilitate partial submits.

The Address Form demo from the ICEfaces samples illustrates a couple of different mechanisms that can be leveraged under a partial submit. Standard validators are attached to City, State, and ZIP input fields to catch invalid entries, but inter-field evaluation on the {City:State:ZIP}-tuple is also performed. Using valueChangedEvents associated with these input controls, it is possible to do inter-field analysis and morph the form based on current input. For example, entering a valid City will cause the State input control to change from an input text control to a select-one-of-many controls containing only the States that have a matching City.



Copyright 2005-2009. ICEsoft Technologies, Inc.
TOC PREV NEXT INDEX