a4j:form functionality is similar to the standard h:form component except two additional features:

- Along with a4j:htmlCommandLink, it fixes the problem of h:commandLink component that cannot be re-rendered without re-rendering the whole form it belongs to.
- It might convert all non-ajax action components (including the third party components) to the ajaxian ones if ajaxSubmit attribute is set to true

h:commandLink renderer generates the javascript code that is used to submit the form when the link is clicked. However, if the h:commandLink is rendered outside of the form, for example, when you point to it with reRender, the wrong code is generated that causes the broken functionality when user clicks this link later. The example of problematic code is below. To fix the code, you need to replace h:form with a4j:form and h:commandLink with a4j:htmlCommandLink.

Code Example

When ajaxSubmit="true", all standard action components on this form become ajaxable. This approach is similar to the one AjaxAnywhere framework uses. If a form works in an ajax mode, the standard ajax attribute such as reRender, eventQueue, requestDelay can be used. The following example shows the difference between partial and full-page refreshing. In both cases, the regular h:commandButton is used for the form submission.

AjaxForm Demo

Note:You should not use a4j:form ajaxSubmit="true" if it contains other ajax command components. Also, due to the security reason, uploadFile form element cannot be convertible to the be ajaxable.

For additional information about attributes of this component read .