RE: [Trinidad] panelTabbed - validation of unvisited tabs

2007-07-20 Thread Peter Rawlins

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.




Re: [Trinidad] panelTabbed - validation of unvisited tabs

2007-07-19 Thread Adam Winer

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󝇪

I'm using trinidad-1.0.1.



RE: [Trinidad] panelTabbed - validation of unvisited tabs - apologies for duplicate

2007-07-19 Thread Peter Rawlins
the original didn't appear for over 12 hours :-(


[Trinidad] panelTabbed - validation of unvisited tabs

2007-07-19 Thread Peter Rawlins
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.

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󝇪

I'm using trinidad-1.0.1.