previous | index | next

Accessing View State (the JSF Component Tree)

Since a JSF validator is being used to validate the zip code, the zip code component must be available to it.

That component is part of the view state, which is only available to Post requests. ( ... )

Therefore, the zipChanged function generates a Post, rather than Get, request when the fifth zip code character is entered.

Also, note the URL that is sent in the request:

    function zipChanged(zip) {
        if(zip.length != 5) {
            hideErrorsDiv();
            return;
        }
        new Ajax.Request(window.document.forms[0].action,
           {       method: "post",
               parameters: "ajax=true&zip=" + zip,
               onComplete: processRealtimeValidation
           });
    }

previous | index | next