On 7/18/07, Peter Rawlins <[EMAIL PROTECTED]> wrote:


I have a form containing various input fields followed by a panelTabbed, and
lastly an OK commandButton.  The panelTabbed contains some showDetailItem
children, which have various input fields, some of which have
required=true.  The users may visit the tabs as they see fit, and then press
the OK button, and I need each showDetailItem child to be valid as a
precondition for the button action.

However if a showDetailItem is not disclosed it will not validate its
children.  So if the user doesn't happen to visit every tab, the unvisited
tabs may not be valid, but the validation phase passes, and the
commandButton's action method is invoked.

This behaviour seems wrong to me, as I would have expected that all
rendered=true fields inside a form should be valid before the form is
considered valid.  Does anyone know of a way to force the display of the
invalid tabs, with their errors?

I've attempted a workaround by adding code to temporarily disclose the other
tabs in turn, and manually call processValidators() on them, but this
doesn't work because the input fields of the undisclosed tabs have no
submitted data, and claim to be valid (which also seems strange).  I've also
considered adding code to replace submitted values of null with "", but this
seems like a kludge too far.

There's two questions here:
(1) Is there a way to validate tabs that have been disclosed,
 but aren't disclosed right now?
(2) Is there a way to validate tabs that have never been disclosed.

For 1, the answer is yes:  call processValidators() and
processUpdateModel() on the children of the showDetailItem.

For 2, the answer is no, you can't.  And you can't set
the submitted value to "", because that'll blow up
for many renderers.

What you need here is bean-level validation, not
component-level validation.  Alternatively, you might
disable the button until all tabs have been visited.

-- Adam







Looking through the mailing lists, I found an old thread which looked
similar, but no solution:
http://forums.oracle.com/forums/thread.jspa?messageID=905706&#905706

I'm using trinidad-1.0.1.

Reply via email to