Opened 14 years ago

Closed 13 years ago

Last modified 12 years ago

#721 closed defect (fixed)

DropdownDatePicker + value from submit

Reported by: joose@… Owned by: Adam Peller
Priority: high Milestone:
Component: Widgets Version: 0.3
Keywords: Dropdowndatepicker Cc: joose@…
Blocked By: Blocking:

Description

DropdownDatepicker? should save it's value to hidden input field in rfc-format when changing the date. Also this could be configurable thing: <div dojoType="dropdowndatepicker" displayFormat="%d.%m.%y" saveFormat="RFC" or saveFormat="%m/%d/%y" .. />

Attachments (6)

dropdowndatepicker-fix.patch (2.1 KB) - added by joose@… 13 years ago.
Patch to fix dropdowndatepicker (submitting, name, value.. etc)
dropdowndatepicker-fix.2.patch (2.4 KB) - added by joose@… 13 years ago.
Patch to fix dropdowndatepicker (submitting, name, value.. etc) also fixes when date is inputted manually
dropdowndatepicker-fix.3.patch (2.4 KB) - added by joose@… 13 years ago.
little fix to fix little thing. Thanks to dimas.
dddp-i18n-submit-r5597.patch (10.8 KB) - added by Adam Peller 13 years ago.
cumulative i18n changes from ticket 1008 with an adaptation of Joose's patch
dddp-i18n-submit-r5629.patch (7.1 KB) - added by Adam Peller 13 years ago.
cumulative i18n changes from ticket 1008 with an adaptation of Joose's patch
test-dddp-i18n-submit-r5629.patch (3.7 KB) - added by Adam Peller 13 years ago.
tests for dddp localization and serialization

Download all attachments as: .zip

Change History (16)

comment:1 Changed 14 years ago by ComboBox and it''s value

Keywords: ComboBox added; Dropdowndatepicker removed

ComboBox? places (in some cases) wrong value to field named in HTML... Consider this:

<select name="foo" dojoType="combobox">
 <option value="1">aaa</option>
 <option value="2">bbb</option>
 <option value="3">ccc</option>
</select>

when form is read, foo's value is "aaa" or "bbb" or "ccc", when it should be 1,2 or 3. OF course, this behaviour should be configured behavior, because it is not wanted always. It places the "key" to foo_selected, but it's not good if we already have software to handle foo as key.

comment:2 Changed 14 years ago by joose@…

Keywords: Dropdowndatepicker added; ComboBox removed

Ush, my mistake. Combobox is found from ticket #730

comment:3 Changed 14 years ago by bill

Basically this bug is saying that the display format of the date should be independent from the format sent over the wire, because the display format will change based on locale settings, whereas the value sent over the wire should be locale-independent.

This functionality would make life easier for the server, but it complicates the DropDownDatePicker? code. Note that the user can type in a date manually, rather than clicking the drop down; in that case the DropDownDatePicker? would need code to parse the date and convert it to RFC format.

comment:4 Changed 14 years ago by anonymous

Here is somewhat patch to fix part of this:

$ svn diff DropdownContainer.js 
Index: DropdownContainer.js
===================================================================
--- DropdownContainer.js        (revision 4162)
+++ DropdownContainer.js        (working copy)
@@ -29,7 +29,7 @@
                containerToggleDuration: 150,
                containerAnimInProgress: false,
 
-               templateString: '<div><span style="white-space:nowrap"><input type="text" value="" style="vertical-align:middle;" dojoAttachPoint="inputNode" autocomplete="off" /> <img src="" alt="" dojoAttachPoint="buttonNode" dojoAttachEvent="onclick: onIconClick;" style="vertical-align:middle; cursor:pointer; cursor:hand;" /></span><br /><div dojoAttachPoint="containerNode" style="display:none;position:absolute;width:12em;background-color:#fff;"></div></div>',
+               templateString: '<div><span style="white-space:nowrap"><input name="" type="text" value="" style="vertical-align:middle;" dojoAttachPoint="inputNode" autocomplete="off" /> <img src="" alt="" dojoAttachPoint="buttonNode" dojoAttachEvent="onclick: onIconClick;" style="vertical-align:middle; cursor:pointer; cursor:hand;" /></span><br /><div dojoAttachPoint="containerNode" style="display:none;position:absolute;width:12em;background-color:#fff;"></div></div>',
                templateCssPath: "",
 
                fillInTemplate: function(args, frag){
$ svn diff DropdownDatePicker.js 
Index: DropdownDatePicker.js
===================================================================
--- DropdownDatePicker.js       (revision 4162)
+++ DropdownDatePicker.js       (working copy)
@@ -14,7 +14,7 @@
                iconTitle: "Select a Date",
                zIndex: "10",
                datePicker: null,
-
+               name: "",
                dateFormat: "%m/%d/%Y",
                date: null,
 
@@ -37,6 +37,7 @@
                        dojo.event.connect(this.datePicker, "onSetDate", this, "onSetDate");
                        this.containerNode.style.zIndex = this.zIndex;
                        this.containerNode.style.backgroundColor = "transparent";
+                        this.inputNode.name=this.name;
                },
 
                onSetDate: function(){

comment:5 Changed 14 years ago by joose@…

Forget to put my email to my previous comment (the patches).

comment:6 Changed 14 years ago by joose@…

Here is updated patch to save dropdownDatepickers value as RFC value to hidden field.

$ svn diff DropdownDatePicker.js DropdownContainer.js html/DatePicker.js 
Index: DropdownDatePicker.js
===================================================================
--- DropdownDatePicker.js       (revision 4162)
+++ DropdownDatePicker.js       (working copy)
@@ -14,7 +14,7 @@
                iconTitle: "Select a Date",
                zIndex: "10",
                datePicker: null,
-
+               name: "",
                dateFormat: "%m/%d/%Y",
                date: null,
 
@@ -37,10 +37,12 @@
                        dojo.event.connect(this.datePicker, "onSetDate", this, "onSetDate");
                        this.containerNode.style.zIndex = this.zIndex;
                        this.containerNode.style.backgroundColor = "transparent";
+                        this.valueNode.name=this.name;
                },
 
                onSetDate: function(){
                        this.inputNode.value = dojo.date.format(this.datePicker.date, this.dateFormat);
+                        this.valueNode.value = this.datePicker.storedDate;
                        this.hideContainer();
                },
 
Index: DropdownContainer.js
===================================================================
--- DropdownContainer.js        (revision 4162)
+++ DropdownContainer.js        (working copy)
@@ -29,7 +29,7 @@
                containerToggleDuration: 150,
                containerAnimInProgress: false,
 
-               templateString: '<div><span style="white-space:nowrap"><input type="text" value="" style="vertical-align:middle;" dojoAttachPoint="inputNode" autocomplete="off" /> <img src="" alt="" dojoAttachPoint="buttonNode" dojoAttachEvent="onclick: onIconClick;" style="vertical-align:middle; cursor:pointer; cursor:hand;" /></span><br /><div dojoAttachPoint="containerNode" style="display:none;position:absolute;width:12em;background-color:#fff;"></div></div>',
+               templateString: '<div><span style="white-space:nowrap"><input type="hidden" name="" value="" dojoAttachPoint="valueNode" /><input name="" type="text" value="" style="vertical-align:middle;" dojoAttachPoint="inputNode" autocomplete="off" /> <img src="" alt="" dojoAttachPoint="buttonNode" dojoAttachEvent="onclick: onIconClick;" style="vertical-align:middle; cursor:pointer; cursor:hand;" /></span><br /><div dojoAttachPoint="containerNode" style="display:none;position:absolute;width:12em;background-color:#fff;"></div></div>',
                templateCssPath: "",
 
                fillInTemplate: function(args, frag){

Changed 13 years ago by joose@…

Patch to fix dropdowndatepicker (submitting, name, value.. etc)

Changed 13 years ago by joose@…

Patch to fix dropdowndatepicker (submitting, name, value.. etc) also fixes when date is inputted manually

Changed 13 years ago by joose@…

little fix to fix little thing. Thanks to dimas.

comment:7 Changed 13 years ago by dylan

Owner: changed from anonymous to dylan
Status: newassigned

comment:8 Changed 13 years ago by Adam Peller

Owner: changed from dylan to Adam Peller
Status: assignednew

Changed 13 years ago by Adam Peller

cumulative i18n changes from ticket 1008 with an adaptation of Joose's patch

Changed 13 years ago by Adam Peller

cumulative i18n changes from ticket 1008 with an adaptation of Joose's patch

Changed 13 years ago by Adam Peller

tests for dddp localization and serialization

comment:9 Changed 13 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [5637]) DropdownDatePicker? handling of locale-based formatting and parsing of dates (fixes #1008, fixes #821) Use locale-independent serialization for dddp in a form (fixes #721) Removed experimental from dojo.date.parse (fixes #835)

comment:10 Changed 12 years ago by (none)

Milestone: 0.4

Milestone 0.4 deleted

Note: See TracTickets for help on using tickets.