bruno 2004/05/08 05:52:10
Modified: src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2
Form.js
Log:
Fixed getWidget() behaviour.
Revision Changes Path
1.9 +14 -7
cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/Form.js
Index: Form.js
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/Form.js,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Form.js 8 May 2004 12:13:34 -0000 1.8
+++ Form.js 8 May 2004 12:52:10 -0000 1.9
@@ -44,7 +44,6 @@
form = formMgr.createForm(formDefinition)
}
this.binding_ = null;
- this.form = form;
this.formWidget_ = new Widget(form);
this.local_ = cocoon.createPageLocal();
this.locale = java.util.Locale.getDefault();
@@ -56,18 +55,26 @@
}
/**
- * Get the actual Form-Widget (the Java object)
+ * Get a Widget from the form.
+ * If <code>name</code> is undefined, the form widget itself is returned.
+ * Otherwise, the form's child widget of name <code>name</code> is returned.
*/
-Form.prototype.getWidget = function() {
- return this.form;
+Form.prototype.getWidget = function(name) {
+ var result;
+ if (name == undefined) {
+ result = this.formWidget_;
+ } else {
+ result = this.formWidget_.getChild(name);
+ }
+ return result;
}
/**
* Get a Widget from the form.
- * If <code>name</code> is undefined, the form widget itself is returned.
- * Otherwise, the form's child widget of name <code>name</code> is returned.
+ * If <code>path</code> is undefined, the form widget itself is returned.
+ * Otherwise, the widget addressed by the specified path is looked up.
*/
-Form.prototype.lookupWidget = function(name) {
+Form.prototype.lookupWidget = function(path) {
var result;
if (name == undefined) {
result = this.formWidget_;