Component identification parameters

Name | Value
--- | ---
component-type | org.ajax4jsf.Form
component-family | javax.faces.Form
component-class | org.ajax4jsf.component.html.AjaxForm
renderer-type | org.ajax4jsf.FormRenderer

## Creating on a page

Component definition on a page is similar to definition of the original component from JSF HTML library.

    <a4j:form>
    	<!--...Some content to be submitted.-->
    </a4j:form>

## Dynamical creation of a component from Java code

Example:

    import org.ajax4jsf.component.html.AjaxForm;
    ...
    AjaxForm myForm = new AjaxForm();
    ...

## Key attributes and ways of usage

The difference with the original component is that all hidden fields required for command links are always rendered and it doesn't depend on links rendering on the initial page. It solves the problem with invalid links that weren't rendered on a page immediately, but after some Ajax request.

Beginning with release 1.0.5 additional attributes that make this form variant universal have appeared. With a new attribute definition as ajax= "true" , it becomes possible to set Ajax submission way for any components inside, i.e. not a page URL is used as an "action" attribute, but the javascript:A4J.AJAX.Submit(...) call. In this case, rendering is defined as "reRender"=list of Ids for the form element itself.

Example

    <a4j:form id="helloForm" ajaxSubmit="true" reRender="table">
    	...
    	<t:dataTable id="table"... >
    		...
    	</t:dataTable>
    	...
    	<t:dataScroller for="table"... >
    		...
    	</t:dataScroller>
    	...
    </a4j:form

This example shows that in order to make <t:dataScroller> submissions to be Ajax ones it's required only to place this <t:dataScroller> into <a4j:form> . In the other case it is necessary to redefine renders for its child links elements that are defined as <h:commandLink> and can't be made Ajax ones with using e.g. <a4j:support> .

## Relevant resources links

Here. you can see the example of <a4j:form> usage and sources for the given example.