myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philipp Ahlner <philipp.ahl...@gmail.com>
Subject Re: [jira] Commented: (MYFACES-214) TabbedPane : wrong validation behavior
Date Thu, 12 May 2005 20:03:26 GMT
Hi Grant!

Tahnks for your answer. My patch was for rc3 and not for trunk. Sorry,
I havent seen that the lines

if (submittedValue != null && submittedValue instanceof String &&
((String) submittedValue).length()==0)
{
    submittedValue = null;
}

are already obsolet in trunk. These lines are not really my problem.
My problem is following line.

if (submittedValue == null) return;

I think this line should be removed to fix this bug, but UIInput is a
very common base-class and I don't have the overview over all
components - so I've bellyache.

Philipp


2005/5/12, Grant Smith <grants@marathon-man.com>:
>  Hi Phillip,
>  
>  Your patch basically reverses a patch made as a suggestion to MYFACES-187.
> Could you test to see if your patch produces the same problem that
> MYFACES-187 describes ? I do see a small difference between your code and
> the original code, so it's possible that your patch fixes both, but we need
> to be sure :)
>  
>  Thanks,
>  Grant.
>  
>  Philipp Ahlner (JIRA) wrote: 
>  [
> http://issues.apache.org/jira/browse/MYFACES-214?page=comments#action_65117
> ]
>  
> Philipp Ahlner commented on MYFACES-214:
> ----------------------------------------
> 
> After a nightly debugging session, I think I know where the problem is. I
> applied my patch and it's working for me. I'll try to explain (in my poor
> english) the problem and the solution.
> 
> The origin problem is not the tabbedpane-component but rather a single line
> in javax.faces.component.UIInput
> 
> The solution:
> In 0.9rc3 in line 284:
> 
> if (submittedValue == null) return;
> 
> the validation stops if the submitted value is null. I think this should
> prevent a NPE on the line below. If removed the return statement and
> modified the line below as followed:
> 
> if (submittedValue != null && submittedValue instanceof String && ((String)
> submittedValue).length()==0)
> {
>  submittedValue = null;
> }
> 
> This also prevents a NPE but the validation is continued with a null as
> submittedValue. UIInput is a base-class of all input elements and this patch
> should made all ui-components work correctly in tabbed panes.
> 
> Let me now explain, why its a problem to stop validation on a null value:
> 
> - If a UIInput-child-element is in a hidden tabbed-pane the submittedValue
> is null and such a element is never validated.
> - If a hidden tab is activated and the HtmlInput is empty (for ex) the
> decode() method of the renderer (HtmlTextRendererBase) sets a empty string
> instead of null to submittedValue. The field will now validated in all cases
> regarding the tab is visible or not.
> 
> That's he reason why a field is not validated until the tab is at least one
> time activated. 
> My patch validates all UIInputs regardless of the value in the
> submittedValue var.
> 
>  
>  
>  TabbedPane : wrong validation behavior
> --------------------------------------
> 
>  Key: MYFACES-214
>  URL: http://issues.apache.org/jira/browse/MYFACES-214
>  Project: MyFaces
>  Type: Bug
>  Versions: 1.0.9 beta
>  Environment: MyFaces 1.0.9rc3, Tomcat 5.0.27, j2sdk1.5.0_01
>  Reporter: Philipp Ahlner
>  
>  
>  
>  Requirements for reproduction:
> - min. two tabs with min. one required Input-Fields
> - a submit button on each tab
> - an "<h:messages styleClass="errors" showDetail="true"
> showSummary="true"/>"-tag to see all validation errors regardless which tab
> is selected
> Expected behavior:
> - if the submit button is pressed, !both! fields should be validated
> regardless which tab is selected
> Steps to reproduce:
> 1. start a new session
> 2. let the required text fields empty
> 3. press the submit button in the first tab.
> Behavior:
> Only the field(s) on the first tab is validated.
> The interesting effect:
> Select the second tab and press submit. The validation errors on !both! tab
> occours. If the tab was 
> activated at least one time in a new session, all fields were validated
> correctly.
> Further informations:
> http://www.mail-archive.com/users%40myfaces.apache.org/msg03525.html
>  
>  
>  
>

Mime
View raw message