Opened 12 years ago

Closed 12 years ago

Last modified 8 years ago

#4514 closed defect (invalid)

DateTextBox lang attribute not working in IE

Reported by: guest Owned by:
Priority: high Milestone:
Component: Dijit - Form Version: 0.9
Keywords: lang, DateTextBox, locale Cc:
Blocked By: Blocking:

Description

I have two DateTextBox? widgets on a page for which I want to set custom date format and lang attribute. This works in Firefox 2.0.0.7, But not in IE 6.0 SP2. In IE6 the date format is yy/mm/dd, no matter what.

Example

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login Statistics</title>
<link href="/CSS/login_stats.css"
	rel="stylesheet" type="text/css"></link>
<style type="text/css">
@import
	"/js/dojo-release-0.9.0/dijit/themes/tundra/tundra.css"
	;
@import
"/js/dojo-release-0.9.0/dojo/dojo.css"
</style>
<script type="text/javascript"
	src="/js/dojo-release-0.9.0/dojo/dojo.js"
	djConfig="parseOnLoad: true, lang: 'sv-se', locale: 'sv-se', extraLocale: ['sv-se','de-de','en-us']"></script>
<script type="text/javascript">
	   dojo.require("dojo.parser");
 	   dojo.require("dijit.form.DateTextBox");
       dojo.require("dijit.form.Form");
       dojo.require("dijit.form.Button");
       dojo.requireLocalization("dojo.cldr", "gregorian", null, "ROOT,en,en-au,sv,sv-se,fr,ja,zh,en-ca,pt-br,pt,es,es-es,it,ko,de,zh-cn,ko-kr,en-gb,it-it");    
	function dateChangedFrom(event)
	{
	    toDate = dojo.byId('toDate');
	    fromDate = dojo.byId('fromDate');
	    fromDate.value = event;
	    var kw = {
	    content: {"fromDate": fromDate.value, "toDate": toDate.value },
        url: "login_stats_table.jsp",
        load: function(data){
                dojo.byId('loginStats').innerHTML = data;
        },
        error: function(data){
                alert("Holy Bomb Box, Batman!  An error occurred: " + data);
        },
        timeout: 3000
        };	
        dojo.xhrGet(kw);	    
	}	
	function dateChangedTo(event)
	{
		fromDate = dojo.byId('fromDate');	    
	    toDate = dojo.byId('toDate');
	    toDate.value = event;
	    var kw = {
	    content: {"fromDate": fromDate.value, "toDate": toDate.value },
        url: "login_stats_table.jsp",
        load: function(data){
                dojo.byId('loginStats').innerHTML = data;
        },
        error: function(data){
                alert("Holy Bomb Box, Batman!  An error occurred: " + data);
        },
        timeout: 3000
        };	
        dojo.xhrGet(kw);
	}
</script>

</head>

<body class="tundra">

<form widgetid="myForm2" id="myForm2" name="myForm2" method="post"
	action="." dojoType="dijit.form.Form" execute="dateChangedFrom(this);"><label for="fromDateP">From</label><input
	type="text" widgetid="fromDateP" name="fromDateP" id="fromDateP"
	value="2007-09-01" dojoType="dijit.form.DateTextBox" required="true"
	lang="sv-se" promptMessage="yyyy-MM-dd"
	onchange="dateChangedFrom(this);"
	,
	constraints:{datePattern:'yyyy-MM-dd'},
	invalidMessage="Invalid date. Use yyyy-mm-dd format."></input>
<label for="toDateP">To</label><input type="text" widgetid="toDateP"
	name="toDateP" id="toDateP" value="2007-09-20"
	dojoType="dijit.form.DateTextBox" required="true" lang="sv-se"
	promptMessage="yyyy-MM-dd" onchange="dateChangedTo(this);"
	,
	constraints:{datePattern:'yyyy-MM-dd'},
	invalidMessage="Invalid date. Use yyyy-mm-dd format."></input>
<input type="hidden" id="toDate" name="toDate"></input> 
<input type="hidden" id="fromDate" name="fromDate"></input>
</form>
<div id="loginStats"></div>
<script type="text/javascript">
dojo.connect(dojo.byId("fromDateP"),'_onChange',dateChangedFrom);
dojo.connect(dojo.byId("toDateP"),'_onChange',dateChangedTo);
</script>
</body>
</html>

Change History (5)

comment:1 Changed 12 years ago by guest

The localization used does not work either in IE6, but in Firefox (I use a cldr gregorian file for locale sv-se)

comment:2 Changed 12 years ago by Adam Peller

Resolution: wontfix
Status: newclosed

you've got syntax errors in your HTML. constraints should be an HTML argument with "=" instead of ":". That seems to solve the problem.

Also, most of the attributes here are unneeded, including the lang= settings. You hardly ever need to set lang. I just tried to update the docs to be more clear:

http://dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/common-attributes

Also, you should build your sv-se cldr resources using scripts in util/buildscripts cldr, which among other things should provide the correct datePattern by default.

comment:3 Changed 12 years ago by Adam Peller

Resolution: wontfix
Status: closedreopened

oops. I meant invalid.

comment:4 Changed 12 years ago by Adam Peller

Resolution: invalid
Status: reopenedclosed

comment:5 Changed 8 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.