You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by sy...@apache.org on 2003/08/16 15:22:28 UTC
cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel Field.java
sylvain 2003/08/16 06:22:28
Modified: src/blocks/woody/java/org/apache/cocoon/woody/flow/javascript
woody.js
src/blocks/woody/java/org/apache/cocoon/woody/formmodel
Field.java
Log:
- add Field.setValidationError(), required by flow-based validation
- flowscript access to the "real" widgets using form.getWidget()
- fix call order or the flow-provided validation function (was even if form was invalid)
Revision Changes Path
1.8 +15 -2 cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/flow/javascript/woody.js
Index: woody.js
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/flow/javascript/woody.js,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- woody.js 26 Jul 2003 14:05:05 -0000 1.7
+++ woody.js 16 Aug 2003 13:22:28 -0000 1.8
@@ -104,6 +104,19 @@
return this.formWidget;
}
+/**
+ * Get a Widget (the java object) 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(name) {
+ if (name == undefined) {
+ return this.form;
+ } else {
+ return this.form.getWidget(name);
+ }
+}
+
Form.prototype.show = function(uri, validator, locale) {
var lastWebCont = this.lastWebContinuation;
// create a continuation, the invocation of which will resend
@@ -140,8 +153,8 @@
} else {
this.submitId = undefined;
}
- if (validator != undefined) {
- finished = validator(this) && finished;
+ if (finished && validator != undefined) {
+ finished = validator(this);
}
if (finished) {
break;
1.9 +10 -0 cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/Field.java
Index: Field.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/Field.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Field.java 28 Jul 2003 15:57:15 -0000 1.8
+++ Field.java 16 Aug 2003 13:22:28 -0000 1.9
@@ -144,6 +144,16 @@
public ValidationError getValidationError() {
return validationError;
}
+
+ /**
+ * Set a validation error on this field. This allows fields to be externally marked as invalid by
+ * application logic.
+ *
+ * @param error the validation error
+ */
+ public void setValidationError(ValidationError error) {
+ this.validationError = error;
+ }
public boolean isRequired() {
return definition.isRequired();