[ 
https://issues.apache.org/jira/browse/WICKET-500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eelco Hillenius resolved WICKET-500.
------------------------------------

    Resolution: Fixed

I solved it by removing final from FormComponent#getConvertedInput and 
implementing that method appropriately in DateField and DateTimeField. This 
replaces the implementation of updateModel.

Comment from DateField's and DateTimeField's getConvertedInput Javadoc:

         * Note that overriding this method is a better option than overriding
         * [EMAIL PROTECTED] #updateModel()} like the first versions of this 
class did. The
         * reason for that is that this method can be used by form validators
         * without having to depend on the actual model being updated, and this
         * method is called by the default implementation of [EMAIL PROTECTED] 
#updateModel()}
         * anyway (so we don't have to override that anymore).





> org.apache.wicket.extensions.yui.calendar.DateField; throws NPE upon 
> validation.
> --------------------------------------------------------------------------------
>
>                 Key: WICKET-500
>                 URL: https://issues.apache.org/jira/browse/WICKET-500
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-datetime
>         Environment: URL: 
> https://svn.apache.org/repos/asf/incubator/wicket/trunk/jdk-1.4/wicket-datetime
> Revision: 532322
>            Reporter: Martin Funk
>            Assignee: Eelco Hillenius
>             Fix For: 1.3.0-rc1
>
>
> org.apache.wicket.extensions.yui.calendar.DateField; throws NPE upon 
> validation.
> The situation:
> markup:
> <span wicket:id="arrivalDateProperty" id="arrivalDateProperty"
>                                       type="text" size="15"></span>
> the code:
>                       final DateField arrivalDatePropertyTextField = new 
> DateField(
>                                       "arrivalDateProperty");
>                       arrivalDatePropertyTextField.add(DateValidator
>                                       .minimum(new DateMidnight().toDate()));
>                       add(arrivalDatePropertyTextField);
> the generated markup:
> <span id="arrivalDateProperty" name="arrivalDateProperty" type="text" 
> size="15">
>   <span style="white-space: nowrap;">
>     <input id="date0" name="arrivalDateProperty:date" value="25.04.07" 
> type="text" size="8"/>
> <span>&nbsp;<div style="display:none;z-index: 99999;position:absolute;" 
> id="date0Dp"></div><img style="cursor: pointer; border: none;" id="date0Icon" 
> src="resources/org.apache.wicket.extensions.yui.calendar.DatePicker/icon1.gif"
>  /></span><input type="hidden"/>
>   </span>
> </span>
> The stacktrace
> DateConverter.convertToObject(String, Locale) line: 37        
> DateField(FormComponent).convert() line: 803  
> Form$13.validate(FormComponent) line: 1051    
> [...]
> shows that DateField 's convert() is called, which in this situation is 
> looking for the parameter "arrivalDateProperty" whereas it probably should 
> look for the parameter "arrivalDateProperty:date"
> Probably its DateTextField value should be validated.
> My first shot would be delegating the the DateField 's convert() method to 
> its DateTextField ' s convert() method,
> but maybe the wicket way is different.
> mf

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

Reply via email to