开发者

Skipping a nested <a4j:region>

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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜