Hi Boris,
1) Use the attribute mmediate="true" in your cancel button to bypass
the validation.
2) Only the first child component of a facet is renderer. I recommend
you to put your buttons inside a panelGroup component, so the
panelGroup will be the only child,
Regards,
Bruno
2005/7/22, Klug, Boris <[EMAIL PROTECTED]>:
> Hi!
>
> I have two questions regarding forms. I think they are quite simply - for you,
> not for me ;-)
>
> 1) Leaving a page without validation.
> I have a form (see 2) with input field that are validates, e.g. a
> required="true". The validation should be checked if the OK submit button is
> hit. This works fine. But when the Cancel button is hit, the validation should
> not be checked.
> So how can I enable/disable the validation depending on the button clicked?
>
> 2) One button missing in the rendered page.
> See the jsp page snippet below (*1). The button "Cancel" is not rendered in
> the
> resulting html page. When I put the form tag around the two buttons in the
> footer facet (see *2) , both buttons are rended. Why?
>
> Thank you for your help in advance
>
>
> ================== (*1) Button missing ===============
> <h:form>
> <h:panelGrid columns="3" styleClass="standardDialog"
>
> headerClass="standardDialogHeader"
>
> footerClass="standardDialogFooter">
> <f:facet name="header">
> <h:outputText value="Einstellungen" />
> </f:facet>
>
> <h:outputText value="Max. Anzahl der angezeigten Objekte:" />
> <h:inputText id="maxobj" value="#{prefs.maxObjectCount}"
> maxlength="5"
> size="10" required="true" />
> <h:message for="maxobj" styleClass="error" />
>
> <h:outputText value="Teilmengen von Objekten anzeigen" />
> <h:selectBooleanCheckbox id="showSubsets"
> value="#{prefs.showObjectsInSubset}" />
> <h:message for="showSubsets" styleClass="error" />
>
> <f:facet name="footer">
> <h:commandButton value="OK"
> action="#{prefs.outOk}" />
> <h:commandButton value="Cancel"
> action="#{prefs.outCancel}" />
> </f:facet>
> </h:panelGrid>
>
> </h:form>
>
> ================== (*2) Both buttons are rendered ===============
> <h:panelGrid columns="3" styleClass="standardDialog"
>
> headerClass="standardDialogHeader"
>
> footerClass="standardDialogFooter">
> <f:facet name="header">
> <h:outputText value="Einstellungen" />
> </f:facet>
>
> <h:form>
> <h:outputText value="Max. Anzahl der angezeigten Objekte:" />
> <h:inputText id="maxobj" value="#{prefs.maxObjectCount}"
> maxlength="5"
> size="10" required="true" />
> <h:message for="maxobj" styleClass="error" />
>
> <h:outputText value="Teilmengen von Objekten anzeigen" />
> <h:selectBooleanCheckbox id="showSubsets"
> value="#{prefs.showObjectsInSubset}" />
> <h:message for="showSubsets" styleClass="error" />
> </h:form>
>
> <f:facet name="footer">
> <h:form>
> <h:commandButton value="OK"
> action="#{prefs.outOk}" />
> <h:commandButton value="Cancel"
> action="#{prefs.outCancel}" />
> </h:form>
> </f:facet>
> </h:panelGrid>
>
>
>
>
> --
> Boris Klug
>