Problem with confirm and back buttons in form

Hi, I've a strange problem with a jfs page.

I'm trying to insert some data in a DB.

My page had 2 textfields mandatory (required=true)

<h:panelGroup>

<h:form id="form_inserimento_areevaste" style="display: inline; padding: 0px; margin: 0px">

<h:panelGrid columns="3">

<h:outputText value="Code" />

<h:inputText value="#{areeVasteBean.current.id.t98IdAreavasta}" required="true" id="ins_cod">

<f:validateLength maximum="10" minimum="1" />

</h:inputText>

<h:message for="ins_cod" fatalClass="fatalStyle" errorClass="errorStyle" infoClass="infoStyle" warnClass="warnStyle"/>

<h:outputText value="Name" />

<h:inputText value="#{areeVasteBean.current.t98Nome}" required="true" id="ins_nome">

<f:validateLength maximum="255" minimum="1" />

</h:inputText>

<h:message for="ins_nome" fatalClass="fatalStyle" errorClass="errorStyle" infoClass="infoStyle" warnClass="warnStyle"/>

</h:panelGrid>

<a4j:commandButton action="#{areeVasteBean.add}" value="Save" reRender="tab_T98" ignoreDupResponses="true" requestDelay="400"/>

</h:form>

<h:outputText escape="false" value="<script> setFocus('form_inserimento_areevaste:ins_cod'); </script>"/>

<h:form style="display: inline; padding: 0px; margin: 0px">

<h:commandButton action="#{areeVasteBean.backAndRefresh}" value="Back" title="Back" />

</h:form>

</h:panelGroup>

This is the sequence:

go into the page for insert value and without fill any fields, click on Save.

The jsf notify me (using the <h:message>) that the textfields are mandatory.

Now I fill the textfields BUT click on "Back" button. The action that starts should be "areeVasteBean.backAndRefresh" instead starts the "areeVasteBean.add" (!?!)

What's happen? Can you help me?

[2896 byte] By [Nozzulaa] at [2007-11-27 5:40:48]
# 1
Don't use multiple form tags on a single page.If you want to skip the validation when the user clicks the back button, use immediate="true" on the button.CowKing
IamCowKinga at 2007-7-12 15:17:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...