You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "sivasubramanian (JIRA)" <ji...@apache.org> on 2009/03/24 22:09:03 UTC

[jira] Commented: (WW-1917) Tag datetimepicker gives "Invalid field value for field xxx:" on form submit when browser locale does not match request_locale

    [ https://issues.apache.org/struts/browse/WW-1917?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45769#action_45769 ] 

sivasubramanian commented on WW-1917:
-------------------------------------

It's basically due to locale issue, i changed the type of the variable to String, it works for me after that. You can try changing the type of the variable datepicker to String. Other issue i noticed is we cannot disable or make the textfield as readonly. so if you enter some text, it throws js error.

> Tag datetimepicker gives "Invalid field value for field xxx:" on form submit when browser locale does not match request_locale
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-1917
>                 URL: https://issues.apache.org/struts/browse/WW-1917
>             Project: Struts 2
>          Issue Type: Bug
>         Environment: Linux, JDK 1.6.0, Tomcat 5.5.17, Struts 2.0.6, Eclipse 3.2 Callisto, Firefox 1.5
>            Reporter: Torsten Römer
>            Assignee: Musachy Barroso
>             Fix For: 2.1.0
>
>
> - Deploy struts2-blank-2.0.6
> - Create /example/Datepicker.jsp:
> <%@ taglib prefix="s" uri="/struts-tags" %>
> <s:head theme="ajax"/>
> <s:form action="Datepicker">
> 	<s:datetimepicker label="datepicker" name="datepicker"/>
> 	<s:submit/>
> </s:form>
> Locale: <s:text name="%{locale}"/>
> - Create example.Datepicker.java:
> package example;
> import java.util.Date;
> public class Datepicker extends ExampleSupport {
>   private Date datepicker;
>   
>   public String execute() throws Exception {
>     return SUCCESS;
>   }
>   public Date getDatepicker() {
>     return datepicker;
>   }
>   public void setDatepicker(Date datepicker) {
>     this.datepicker = datepicker;
>   }
> }
> - Add action Datepicker to example.xml:
>         <action name="Datepicker" class="example.Datepicker">
>             <result name="input">/example/Datepicker.jsp</result>
>             <result name="success">/example/Datepicker.jsp</result>
>         </action>
> - Rebuild/restart the example app
> - (Linux) Open a console and check/set the LANG variable. Example: LANG=de_DE.UTF-8
> - Start Firefox from the console
> - Go to the URL http://localhost:8080/struts2-blank-2.0.6/example/Datepicker.jsp
> - Pick some date, the format is dd.MM.yy (this is the correct format for German locale) 
> - Submit the form: No error
> - Add request_locale=en_US to the URL: http://localhost:8080/struts2-blank-2.0.6/example/Datepicker.action?request_locale=en_US
> - Pick some date, the format is still dd.MM.yy (while I think it should be US locale now)
> - Submit the form: There is an error: Invalid field value for field "datepicker", and the redisplayed date is NaN.NaN.aN
> - When changing the request_locale back to de_DE, there are no more errors
> - When adding the attribute displayFormat="yyyy-MM-dd" to the tag, the form subission always fails with the above error, even if request_locale=de_DE

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