You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by br...@apache.org on 2007/01/05 13:35:37 UTC
svn commit: r493015 -
/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/common.js
Author: bruno
Date: Fri Jan 5 04:35:36 2007
New Revision: 493015
URL: http://svn.apache.org/viewvc?view=rev&rev=493015
Log:
In callOnSubmitHandlers, handle case where cocoon.forms.onSubmitHandlers[id] is null. For example, this gave an error in the countryselector example.
Modified:
cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/common.js
Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/common.js
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/common.js?view=diff&rev=493015&r1=493014&r2=493015
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/common.js (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/common.js Fri Jan 5 04:35:36 2007
@@ -187,11 +187,17 @@
// the focus is in an input with an "onchange" and the user clicks on a submit button.
return false;
}
+ if (cocoon.forms.onSubmitHandlers[id] == null) {
+ // When addOnSubmitHandler has never been called, there will be no submit handlers
+ return true;
+ }
for (var i = 0; i < cocoon.forms.onSubmitHandlers[id].length; i++) {
if (cocoon.forms.onSubmitHandlers[id][i].forms_onsubmit() == false) {
// handler cancels the submit
return false;
// TODO: should we allow all onsubmithandlers to be called, but then return the aggregate result ?
+ // (bruno): I don't think so, the first cancel operation should cancel it completely (esp. if this
+ // might be the result of some user interaction)
}
}
// clear it