On 7/19/07, Adam Winer wrote:
>
> 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,  thanks for the quick reply.

I've got quite a lot of similar pages to create using tabbedPanels, so I'd like 
to make the most of the automatic validation based on the declarative page 
definition.

After careful consideration, I've decided to go with your very last suggestion 
- with a slight tweak :-)

I plan to track which tabs have been visited, but leave the button always 
enabled.
When the button is pushed, the action will first perform a check that all 
necessary tabs have been visited, and if not, disclose the next required tab as 
appropriate.  If the check passes, then the normal button action will be 
performed.  I'll be relying on the standard behaviour of not letting the user 
get out of the current tab unless it's valid - so I need to ensure that no 
"immediate" actions switch away from the current tab.

Additionally, I expect to use bean-level validation for cross-field validation 
where the fields are on different tabs.

Many thanks for your help.

Regards,
Peter.


Reply via email to