cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Anderson <>
Subject <fd:validation><fd:javascript>
Date Wed, 26 Oct 2005 17:31:43 GMT
So I was trying to put javascript validation right into my form definition,
but ran into some funkiness (at least from my perspective).

First of all I realized that putting the javascript in a field doesn't
"invalidate" the form:

Here's my form definition:
<fd:failmessage>failed on form</fd:failmessage>
cocoon.log.debug("form returning false");
return false;
<fd:field id="action">
<fd:datatype base="string"/>
cocoon.log.debug("widget returning false");
return false;

What's interesting is that both log messages are printed. However, if I
change the <fd:javascript> on the form to return true then widget.isValid()
returns true even though my action field still returns false. CForms online
documentation for <fd:javascript> says to consult the examples in the
source. I only found one example and it is directly under the form (not the

Question #1: This leads me to believe that maybe I can't put <fd:javascript>
under the <fd:field><fd:validation> element?

Also, the <fd:failmessage> element was wishful thinking on my part which
doesn't seem to do anything. The xml of the form looks the same after the
forms transformer whether I return true or false.

Question #2: Using <fd:javascript> for validation, is there a way to get
messages printed out at all let alone something useful like this

if (!someDAO.getOrders().size() > 0) {
// send "must attach order" message
} else if (!someOtherDAO.isValidCustomer()) {
// send "must register first" message

Maybe I'm just pushing the limits of the javascript validator... any ideas?

View raw message