a4j:form

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.

Example:

    <a4j:form>
           <h:panelGrid>
                        <h:commandButton value="Button" action="#{userBean.nameItMark}" />
           </h:panelGrid>
    </a4j:form>

## Creating the Component Dynamically Using Java

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.

If "ajaxSubmit" attribute is true, it becomes possible to set Ajax submission way for any components inside with the help of the javascript `A4J.AJAX.Submit(...)`call. In this case, the "reRender" attribute contains a list of Ids of components defined for re-rendering. If you have <h:commandButton> or <h:commandLink> inside the form, they work as <a4j:commandButton> .

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> .

With the help of "limitToList" attribute you can limit areas, which are updated after the responses. If "limitToList" is true, only the reRender attribute is taken in account. Therefore, if you use blocks of text wrapped with <a4j:outputPanel> and `ajaxRendered= "true"`, blocks of text are ignored.

Information about the "process" attribute usage you can find in the "Decide what to process" guide section.

## Relevant resources links

On the component LiveDemo page you can see the example of <a4j:form> usage and sources for the given example.