You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "David Delbecq (JIRA)" <de...@myfaces.apache.org> on 2007/05/29 16:36:15 UTC

[jira] Created: (TOMAHAWK-1012) TabbedPane does not validate non-selected tabs in server side tab switching mode

TabbedPane does not validate non-selected tabs in server side tab switching mode
--------------------------------------------------------------------------------

                 Key: TOMAHAWK-1012
                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1012
             Project: MyFaces Tomahawk
          Issue Type: Bug
          Components: Tabbed Pane
    Affects Versions: 1.1.5, 1.1.6-SNAPSHOT
            Reporter: David Delbecq


When your form spreads accross a tabbed pane, the validators of components residing inside not selected tab are not validated. This is a problem because all form need to be validated before writting values to backing beans.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1012) TabbedPane does not validate non-selected tabs in server side tab switching mode

Posted by "David Delbecq (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503363 ] 

David Delbecq commented on TOMAHAWK-1012:
-----------------------------------------

Indeed, only current tab is rendered, and that's what i aim at, my form is far too big and would consume too much bandwith/ browser CPU upon render time to use client side switching, but every part of form must be validated at once (user swithc bettween tabs and subtabs to enter various datas coming from paper document before saving). Moreover, it's a long data entry process and using client state saving increases risks of Session timeouts. Last but not least, as mention on other reports, clientside switching and validation has it's issues too. I strongly believe a complete form separated in tabs, using serverside switching and with full validation is not a useless thing.

Several points of what Mr Zdenek Sochor states are also false (did you actually try those assertion with the patch i provided?):
1) components with "required" are not a problem, component not currently rendered by the tabbed pane are keeping their state on the server, especially their value (which is not yet applied to backing bean). If i modify a field in tab1, go to tab2 then back to tab1, all field are keeping the submitted value as my browser last sent them. I can put a required field in tab1, go to tab2, and then submit. With my patch, tab1 fields are validated and the required field passes without problem because they have a value (coming from previous tab1 editing). Only fields marked required, not having backing bean value and not yet entered by user will fail, but this mean they are actually empty, so it must fail in that case.
2) Tab switching using the tab switching button occurs prior to validation and uses FacesContext.renderResponse() to stop JSF process  and as such, in no way my patch can prevent user-intended tabswitching as validation does not occur during tab switching

On the comment of Mr Cagatay Civici:
I you fear it will break other users of tabbedpane by validating tabs they did not expect to be validated, don't be afraid, my patch only does validation of not rendered pane if you explicitly asked that pane to be validated along with current pane, using the processvalidators="true" tag attribute. So old behaviour of validating only current tab is the default.

Additionnaly, if you look at patch, in case of validation error triggering a tab switching the tab change listener are notified of this change too, so everything, imho, is made in a clean way.

I, additionnaly, notice, nowhere in doc (official and/or wiki) it's stated that non rendered component do not get validated (understand my surprise when i noticed this unexpected behaviour) and the JSF specs, i think, when speaking about validation, mention the component tree, not the submitted components.

IMHO, this is natural for developer to expect it's components to be validated during JSF livecycle. The TabbedPane looks like just a laying out component. Moreover the server/client side tab switching should have similar behaviour, limited by compatibility with old behaviour.

As a conclusion, i personnaly see no argument in previous comment to refuse this patch and mark this bug as invalid. It does not break old behaviour, it's not an heavy change (only a few lines) and adds capabilities to component.


> TabbedPane does not validate non-selected tabs in server side tab switching mode
> --------------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1012
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1012
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Tabbed Pane
>    Affects Versions: 1.1.5, 1.1.6-SNAPSHOT
>            Reporter: David Delbecq
>         Attachments: tabbedPaneValidator.diff
>
>
> When your form spreads accross a tabbed pane, the validators of components residing inside not selected tab are not validated. This is a problem because all form need to be validated before writting values to backing beans.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (TOMAHAWK-1012) TabbedPane does not validate non-selected tabs in server side tab switching mode

Posted by "Cagatay Civici (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503332 ] 

Cagatay Civici edited comment on TOMAHAWK-1012 at 6/11/07 1:50 AM:
-------------------------------------------------------------------

If we checkin this page, then users who use serverside switching will start getting validation errors and etc. As Zdenek mentioned, use client tabs for this purpose.


 was:
If we checkin this page, then users that use serverside switching will start validation errors and etc. As Zdenek mentioned, use client tabs for this purpose.

> TabbedPane does not validate non-selected tabs in server side tab switching mode
> --------------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1012
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1012
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Tabbed Pane
>    Affects Versions: 1.1.5, 1.1.6-SNAPSHOT
>            Reporter: David Delbecq
>         Attachments: tabbedPaneValidator.diff
>
>
> When your form spreads accross a tabbed pane, the validators of components residing inside not selected tab are not validated. This is a problem because all form need to be validated before writting values to backing beans.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1012) TabbedPane does not validate non-selected tabs in server side tab switching mode

Posted by "Paul Spencer (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503421 ] 

Paul Spencer commented on TOMAHAWK-1012:
----------------------------------------

I have add a thread to the dev list titled "TabbedPane does not validate non-selected tabs in server side tab switching mode (Relaed to TOMAHAWK-1012)"

Paul Spencer

> TabbedPane does not validate non-selected tabs in server side tab switching mode
> --------------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1012
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1012
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Tabbed Pane
>    Affects Versions: 1.1.5, 1.1.6-SNAPSHOT
>            Reporter: David Delbecq
>         Attachments: tabbedPaneValidator.diff
>
>
> When your form spreads accross a tabbed pane, the validators of components residing inside not selected tab are not validated. This is a problem because all form need to be validated before writting values to backing beans.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1012) TabbedPane does not validate non-selected tabs in server side tab switching mode

Posted by "Zdenek Sochor (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503379 ] 

Zdenek Sochor commented on TOMAHAWK-1012:
-----------------------------------------

Hi,
I played with the patch and my notes:

1. required components - i meant in all tabs, not just current/first visited tab, but that's connected to:

2. Component tree made by TabbedPane consists only of tabs previously visited (and only for those being rendered). This means that components in all subsequent tabs (even with processValidators=true) are NOT checked.
This is due to internal checks of contents-rendering (not rendering/visiting childs of invisible tabs).

If you want to have full validation of even yet unvisited (render-wise) components you would need to:
a) traverse all posible components regardless of isRendered() checks, but this would mean to 
b) rewrite all composite components in Tomahawk. (All of them create component tree based on rendering being true).

But with comment regarding backward compatibily you're right, it's preserved.

And i'm sorry, user's selecting tab is correct (provided that it hasn't onclick method which submits as i had with first test page)

With regards,
Zdenek

> TabbedPane does not validate non-selected tabs in server side tab switching mode
> --------------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1012
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1012
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Tabbed Pane
>    Affects Versions: 1.1.5, 1.1.6-SNAPSHOT
>            Reporter: David Delbecq
>         Attachments: tabbedPaneValidator.diff
>
>
> When your form spreads accross a tabbed pane, the validators of components residing inside not selected tab are not validated. This is a problem because all form need to be validated before writting values to backing beans.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1012) TabbedPane does not validate non-selected tabs in server side tab switching mode

Posted by "Zdenek Sochor (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503331 ] 

Zdenek Sochor commented on TOMAHAWK-1012:
-----------------------------------------

Hi,
  this issue is IMHO invalid due to intended use of server-side switching mode.
The purpose is to render only active tab to minimize data used in client-server round-trip.

It would be pointless (and error-prone) to validate non-rendered components.

Example:
Imagine setting components to required="true" in non-active tabs. In your patch you're validating them and getting nulls if not setted beforehand in code/backing bean -> error in validation phase.
Next step in patch is automatic switching to last invalid tab, never allowing user to switch to another tab she/he selected (switching ending in the same validation errors).

For validation of all tabs you have to use client-side switching mode (it was designed for the purpose of validating all tabs).

Best regards,
Zdenek

> TabbedPane does not validate non-selected tabs in server side tab switching mode
> --------------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1012
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1012
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Tabbed Pane
>    Affects Versions: 1.1.5, 1.1.6-SNAPSHOT
>            Reporter: David Delbecq
>         Attachments: tabbedPaneValidator.diff
>
>
> When your form spreads accross a tabbed pane, the validators of components residing inside not selected tab are not validated. This is a problem because all form need to be validated before writting values to backing beans.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1012) TabbedPane does not validate non-selected tabs in server side tab switching mode

Posted by "Zdenek Sochor (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503390 ] 

Zdenek Sochor commented on TOMAHAWK-1012:
-----------------------------------------

Hi,
  this should be last comment in JIRA - we should move discussion elsewhere (now it's stariting to bloat JIRA with it - we should move to dev-list).

processValidators is recursive method - it's called for each and every component in the (sub)tree, so if current component's (regardless of depth) rendered attribute is false, it stops validating for itself AND all children components.

In this exact case: if PanelTab is not rendered, it (according to spec) MUST stop validation of itself and all children components.

With regards,
Zdenek

> TabbedPane does not validate non-selected tabs in server side tab switching mode
> --------------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1012
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1012
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Tabbed Pane
>    Affects Versions: 1.1.5, 1.1.6-SNAPSHOT
>            Reporter: David Delbecq
>         Attachments: tabbedPaneValidator.diff
>
>
> When your form spreads accross a tabbed pane, the validators of components residing inside not selected tab are not validated. This is a problem because all form need to be validated before writting values to backing beans.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1012) TabbedPane does not validate non-selected tabs in server side tab switching mode

Posted by "Cagatay Civici (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503332 ] 

Cagatay Civici commented on TOMAHAWK-1012:
------------------------------------------

If we checkin this page, then users that use serverside switching will start validation errors and etc. As Zdenek mentioned, use client tabs for this purpose.

> TabbedPane does not validate non-selected tabs in server side tab switching mode
> --------------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1012
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1012
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Tabbed Pane
>    Affects Versions: 1.1.5, 1.1.6-SNAPSHOT
>            Reporter: David Delbecq
>         Attachments: tabbedPaneValidator.diff
>
>
> When your form spreads accross a tabbed pane, the validators of components residing inside not selected tab are not validated. This is a problem because all form need to be validated before writting values to backing beans.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TOMAHAWK-1012) TabbedPane does not validate non-selected tabs in server side tab switching mode

Posted by "David Delbecq (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/TOMAHAWK-1012?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Delbecq updated TOMAHAWK-1012:
------------------------------------

    Status: Patch Available  (was: Open)

> TabbedPane does not validate non-selected tabs in server side tab switching mode
> --------------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1012
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1012
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Tabbed Pane
>    Affects Versions: 1.1.5, 1.1.6-SNAPSHOT
>            Reporter: David Delbecq
>         Attachments: tabbedPaneValidator.diff
>
>
> When your form spreads accross a tabbed pane, the validators of components residing inside not selected tab are not validated. This is a problem because all form need to be validated before writting values to backing beans.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (TOMAHAWK-1012) TabbedPane does not validate non-selected tabs in server side tab switching mode

Posted by "David Delbecq (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503386 ] 

David Delbecq edited comment on TOMAHAWK-1012 at 6/11/07 5:58 AM:
------------------------------------------------------------------

Hi, first thanks for pointing out problem with children of tab not being in tree until seen for first time, i overlooked this and will check if i can find a proper solution to this.

However, i don't agree on the fact i would break JSF specifications
The specs are telling that HtmlPanelTab should skip further processing of validation if it's rendered attribute is false. Patch never broke this. It's certainly not the job (in the specs) of HtmlPanetTab's parent (this is HtmlPanelTabbedPane) to skip the validation of tabs. Each UIComponent is responsible for itself. If itself must be validated, then call processValidators on all children, which are then responsible for themselves.

I do this in patch:
        * If the rendered property of this HtmlPanelTabbedPane is false, skip further processing.
        * Call the processValidators() method of all facets and children of this UIComponent, in the order determined by a call to getFacetsAndChildren(), except for not currently selected tabs if it's processValidators property is false. 

(to make it short, all tabs have the rendered property set to true unless specified otherwise user and as such are elligible for validation)


Regards,
David


 was:
Hi, first thanks for pointing out problem with children of tab not being in tree until seen for first time, i overlooked this and will check if i can find a proper solution to this.

However, i don't agree on the fact i would break JSF specifications
The specs are telling that HtmlPanelTab should skip further processing of validation if it's rendered attribute is false. Patch never broke this. It's certainly not the job (in the specs) of HtmlPanetTab's parent (this is HtmlPanelTabbedPane) to skip the validation of tabs. Each UIComponent is responsible for itself. If itself must be validated, then call processValidators on all children, which are then responsible for themselves.

I do this in patch:
        * If the rendered property of this HtmlPanelTabbedPane is false, skip further processing.
        * Call the processValidators() method of all facets and children of this UIComponent, in the order determined by a call to getFacetsAndChildren(), except for not currently selected tabs is processValidators property is false. 

(to make it short, all tabs have the rendered property set to true unless specified otherwise user and as such are elligible for validation)


Regards,
David

> TabbedPane does not validate non-selected tabs in server side tab switching mode
> --------------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1012
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1012
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Tabbed Pane
>    Affects Versions: 1.1.5, 1.1.6-SNAPSHOT
>            Reporter: David Delbecq
>         Attachments: tabbedPaneValidator.diff
>
>
> When your form spreads accross a tabbed pane, the validators of components residing inside not selected tab are not validated. This is a problem because all form need to be validated before writting values to backing beans.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1012) TabbedPane does not validate non-selected tabs in server side tab switching mode

Posted by "David Delbecq (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503386 ] 

David Delbecq commented on TOMAHAWK-1012:
-----------------------------------------

Hi, first thanks for pointing out problem with children of tab not being in tree until seen for first time, i overlooked this and will check if i can find a proper solution to this.

However, i don't agree on the fact i would break JSF specifications
The specs are telling that HtmlPanelTab should skip further processing of validation if it's rendered attribute is false. Patch never broke this. It's certainly not the job (in the specs) of HtmlPanetTab's parent (this is HtmlPanelTabbedPane) to skip the validation of tabs. Each UIComponent is responsible for itself. If itself must be validated, then call processValidators on all children, which are then responsible for themselves.

I do this in patch:
        * If the rendered property of this HtmlPanelTabbedPane is false, skip further processing.
        * Call the processValidators() method of all facets and children of this UIComponent, in the order determined by a call to getFacetsAndChildren(), except for not currently selected tabs is processValidators property is false. 

(to make it short, all tabs have the rendered property set to true unless specified otherwise user and as such are elligible for validation)


Regards,
David

> TabbedPane does not validate non-selected tabs in server side tab switching mode
> --------------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1012
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1012
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Tabbed Pane
>    Affects Versions: 1.1.5, 1.1.6-SNAPSHOT
>            Reporter: David Delbecq
>         Attachments: tabbedPaneValidator.diff
>
>
> When your form spreads accross a tabbed pane, the validators of components residing inside not selected tab are not validated. This is a problem because all form need to be validated before writting values to backing beans.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1012) TabbedPane does not validate non-selected tabs in server side tab switching mode

Posted by "Zdenek Sochor (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503381 ] 

Zdenek Sochor commented on TOMAHAWK-1012:
-----------------------------------------

And little side note:

taken from specification's api (UIComponent class):

processValidators

public void processValidators(javax.faces.context.FacesContext context)

    Description copied from class: UIComponent

    Perform the component tree processing required by the Process Validations phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.

        * If the rendered property of this UIComponent is false, skip further processing.
        * Call the processValidators() method of all facets and children of this UIComponent, in the order determined by a call to getFacetsAndChildren().

    Specified by:
        processValidators in class UIComponent

    Parameters:
        context - FacesContext for the request we are processing 
    Throws:
        java.lang.NullPointerException - if context is null

This means that your patch would violate spec's behaviour (validating unrendered components).

With regards,
Zdenek


> TabbedPane does not validate non-selected tabs in server side tab switching mode
> --------------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1012
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1012
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Tabbed Pane
>    Affects Versions: 1.1.5, 1.1.6-SNAPSHOT
>            Reporter: David Delbecq
>         Attachments: tabbedPaneValidator.diff
>
>
> When your form spreads accross a tabbed pane, the validators of components residing inside not selected tab are not validated. This is a problem because all form need to be validated before writting values to backing beans.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.