Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#2568 closed enhancement (wontfix)

[cla] [Patch] Allows DropDown[Date|Time]Picker to disable keyboard entry but not dropDown one

Reported by: guest Owned by: haysmark
Priority: high Milestone: 0.9beta
Component: Dijit Version: 0.4.1
Keywords: Cc:
Blocked By: Blocking:

Description

If we don't want user can input in the field but just allow him to use the drop down. Here is the patch :

Index: /Users/doume/Dev/Wicket/branch-1X/wicket-contrib-dojo/src/main/java/wicket/contrib/dojo/dojo-0.4/src/widget/DropdownDatePicker.js
===================================================================
--- /Users/doume/Dev/Wicket/branch-1X/wicket-contrib-dojo/src/main/java/wicket/contrib/dojo/dojo-0.4/src/widget/DropdownDatePicker.js	(revision 1804)
+++ /Users/doume/Dev/Wicket/branch-1X/wicket-contrib-dojo/src/main/java/wicket/contrib/dojo/dojo-0.4/src/widget/DropdownDatePicker.js	(working copy)
@@ -92,6 +92,9 @@
 		//	disable all incremental controls, must pick a date in the current display
 		staticDisplay: false,
 		
+		//If true disabled the input from keyboard
+		inputNotAllowed:false,
+		
 		templatePath:  dojo.uri.dojoUri("src/widget/templates/DatePicker.htm"),
 		templateCssPath:  dojo.uri.dojoUri("src/widget/templates/DatePicker.css"),
 		
@@ -137,6 +140,9 @@
 			this.containerNode.style.zIndex = this.zIndex;
 			this.containerNode.explodeClassName = "calendarBodyContainer";
 			this.valueNode.name=this.name;
+			
+			//Can disable the input if inputNotAllowed = true
+			this.inputNode.disabled = this.inputNotAllowed;
 		},
 
 		getValue: function(){
@@ -221,7 +227,8 @@
 		},
 		
 		enable: function() {
-			this.inputNode.disabled = false;
+			//Can disable the input if inputNotAllowed = true
+			this.inputNode.disabled = this.inputNotAllowed;
 			this.datePicker.enable();
 			dojo.widget.DropdownDatePicker.superclass.enable.apply(this, arguments);
 		},
Index: /Users/doume/Dev/Wicket/branch-1X/wicket-contrib-dojo/src/main/java/wicket/contrib/dojo/dojo-0.4/src/widget/DropdownTimePicker.js
===================================================================
--- /Users/doume/Dev/Wicket/branch-1X/wicket-contrib-dojo/src/main/java/wicket/contrib/dojo/dojo-0.4/src/widget/DropdownTimePicker.js	(revision 1804)
+++ /Users/doume/Dev/Wicket/branch-1X/wicket-contrib-dojo/src/main/java/wicket/contrib/dojo/dojo-0.4/src/widget/DropdownTimePicker.js	(working copy)
@@ -54,6 +54,8 @@
 		// 	name of the form element, used to create a hidden field by this name for form element submission.
 		name: "",
 		
+		//If true disabled the input from keyboard
+		inputNotAllowed:false,
 		
 		templatePath: dojo.uri.dojoUri("src/widget/templates/TimePicker.htm"),
 		templateCssPath: dojo.uri.dojoUri("src/widget/templates/TimePicker.css"),
@@ -85,6 +87,9 @@
 			}
 			this.valueNode.name=this.name;
 			this.inputNode.name=this.name;
+			
+			//Can disable the input if inputNotAllowed = true
+			this.inputNode.disabled = this.inputNotAllowed;
 		},
 		
 		onSetTime: function(){
@@ -113,7 +118,8 @@
 		
 		enable: function() {
 			// summary: enable this widget to accept user input
-			this.inputNode.disabled = false;
+			//Can disable the input if inputNotAllowed = true
+			this.inputNode.disabled = this.inputNotAllowed;
 			this.timePicker.enable();
 			dojo.widget.DropdownTimePicker.superclass.enable.apply(this, arguments);
 		},

Change History (7)

comment:1 Changed 13 years ago by vdemay@…

Ooops sorry, I've forgotten my email adresse ;)

comment:2 Changed 13 years ago by Adam Peller

Component: GeneralWidgets
Owner: changed from anonymous to bill
Type: defectenhancement

comment:3 Changed 12 years ago by Adam Peller

Owner: changed from bill to Douglas Hays

worth implementing in dijit.DateTextbox??

comment:4 Changed 12 years ago by Douglas Hays

Component: WidgetsDijit
Milestone: 0.9beta
Owner: changed from Douglas Hays to haysmark

Need to add the readOnly attribute to the visible input element.

comment:5 Changed 12 years ago by bill

Resolution: wontfix
Status: newclosed

Hi. Sorry, but I'm gonna mark this as "wontfix". The problem is that for accessibility reasons you need to be able to type in a date/time directly, since the new Calendar widget isn't accessible.

comment:6 Changed 12 years ago by Adam Peller

I'm not sure the a11y concern applies here, Bill. If the widget is disabled, the Calendar is superfluous.

Do we allow disabling the widget? If yes, we must disable either the dropdown or the calendar selection. If not, then I guess there's no bug.

comment:7 Changed 12 years ago by bill

We allow disabling the widget... meaning that the user can't change the value.. but this enhancement is about just disabling keyboard input into the <input> box, but still allowing the user to pick a value from the drop down.

Note: See TracTickets for help on using tickets.