Hi,Jemery

I can't get update from
http://svn.apache.org/repos/asf/cocoon/branches/BRANCH_2_1_X-dojo1_1 for
some time.Is it down or something?

The last mail I send to maillist about this topic talking about
cocoon.forms.Select. I have found that in dojo 1.2 all the widget should add
attribute value not getValue.I have change it in my local source and it
works.The attachment is what I do.I think you may take a more elegent
approach.

Regards

Roy Huang
### Eclipse Workspace Patch 1.0
#P dojo1_1
Index: src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/Select.js
===================================================================
--- src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/Select.js   
(revision 725615)
+++ src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/Select.js   
(working copy)
@@ -85,14 +85,14 @@
 
 TODO: What about cforms datatypes?
       Cocoon sends nice formatted strings; test it works in json response; 
there is some data-type support in dojo.data ... is it useful?
-      Do we need client-side validation on selection lists, where we have no 
'other-value' functionality?
+      Do we need client-side validation on selection lists, where we have no 
'other-value' functionality?      
 */
 
 
 
 dojo.declare("cocoon.forms.Select", [dijit.form._FormValueWidget, 
cocoon.forms._ErrorAwareFieldMixin, cocoon.forms._FieldHintMixin], { 
   
-  templateString: "<div class=\"dijit dijitReset dijitInlineTable dijitLeft\" 
id=\"widget_${id}\"  tabIndex=\"-1\"\r\t><div 
xstyle=\"overflow:hidden;\"\r\t\t><div class=\"dijitReset 
dijitValidationIcon\"><br></div\r\t\t><div class=\"dijitReset 
dijitValidationIconText\">${_cforms_statusMarker}</div\r\t\t><div 
dojoAttachEvent=\"onmouseenter:_onMouse,onmouseleave:_onMouse,onmousedown:_onMouse\"
 class=\"dijitReset\"\r\t\t\t><select name=\"${name}\" class=\"dijitReset \" 
dojoAttachEvent=\"onchange:onChange\" 
dojoAttachPoint=\"focusNode\"\r\t\t></select></div\r\t></div\r></div>\r",
+  templateString: "<div class=\"dijit dijitReset dijitInlineTable dijitLeft\" 
id=\"widget_${id}\"  tabIndex=\"-1\"\r\t><div 
style=\"overflow:hidden;\"\r\t\t><div class=\"dijitReset 
dijitValidationIcon\"><br></div\r\t\t><div class=\"dijitReset 
dijitValidationIconText\">${_cforms_statusMarker}</div\r\t\t><div 
dojoAttachEvent=\"onmouseenter:_onMouse,onmouseleave:_onMouse,onmousedown:_onMouse\"
 class=\"dijitReset\"\r\t\t\t><select name=\"${name}\" class=\"dijitReset \" 
dojoAttachEvent=\"onchange:_onChange\" 
dojoAttachPoint=\"focusNode\"\r\t\t></select></div\r\t></div\r></div>\r",
 
   size: 1,
   multiple: false,
@@ -114,7 +114,14 @@
       this
     );
     this.inherited(arguments);
-  }
+    this.attr('value',this.getValue());
+  },
 
+  getValue: function() {
+         return this.focusNode[this.focusNode.selectedIndex].value;
+  },
   
+  _onChange: function(){
+         this.attr('value',this.getValue());
+  }
 });
\ No newline at end of file

Reply via email to