views:

29

answers:

2

I have a JSF file with a rather large form, the form consists of 3 parts: user data (a set od calendars and data inputs), user items (a data table and a small table with some inputs and a button that adds a new entry based on the information provided in the small table), others (something like user data). I have one huge and every part is a nested (because for example when pressing the "add item" button I want to validate it).

But when I press the "register" button which is supposed to handle the whole huge form (all 3 parts) is there a way to skip a single nested ? Because while registering a new user I don't really need to validate the fields in the data table which is used to add new items. So basically given something like:

<h:form>
<a4j:region>
    <a4j:region>
    </a4j:region>

    <a4j:region id="skipMe">
    </a4j:region>

    <a4j:region>
    </a4j:region>
</a4j:region>
<a4j:commandButton value="Register" action="#{bean.someAction}"/>
</h:form>

Is there a way to skip the validation of all the components in the region with the "skipMe" id when we click the commandButton?

A: 

Maybe not the best solution but I found one - before I used JSR303 annotation validation in the "skipMe" region (@NotNull etc.). Now I simply use the "validator="" " attribute in every field and I write my own validators in the controller, when I press the "Register" button I add an "f:param name="skipValidation" value="true"" which is then used in my validators, when the value is set to true the validation is skipped. Guess it's ok for me since I'd have to write custom validators for this form anyway.

Zenzen
A: 

You could try using process attribute:

where id points to some panel (such as h:panelGrid, not region). You can also bind process to a value binding but make sure the value is available during Apply Request Values phase.

Max Katz
Hey thanks for the answer, I'd be thankful if you could edit it, as here at stackoverflow you need to mark anything between <> as code or it won't be printed ;)
Zenzen
I don't have any code in my reply. What you see is my complete response.
Max Katz