Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 42150 invoked from network); 26 Oct 2005 17:32:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Oct 2005 17:32:14 -0000 Received: (qmail 95635 invoked by uid 500); 26 Oct 2005 17:32:07 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 95590 invoked by uid 500); 26 Oct 2005 17:32:06 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 95579 invoked by uid 99); 26 Oct 2005 17:32:06 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Oct 2005 10:32:06 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of benanderson.us@gmail.com designates 66.249.82.207 as permitted sender) Received: from [66.249.82.207] (HELO xproxy.gmail.com) (66.249.82.207) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Oct 2005 10:32:02 -0700 Received: by xproxy.gmail.com with SMTP id i31so105602wxd for ; Wed, 26 Oct 2005 10:31:43 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=tNTfMYK/6kshwCJx+j4gskP0oKUTQwWUA729JzpDncWHTm1PeqqjiOISTwZfPPrNjgMfcDRXL0bzB293E9ueAAB4OQ6pDJQYrIhegXkCqGcKJ0dK53i2kMSbQQmtGd4/LPrFwYkTBzNECSEacp7XcNqzCpQBe+dCCh3QSjeGvwc= Received: by 10.70.53.17 with SMTP id b17mr654778wxa; Wed, 26 Oct 2005 10:31:43 -0700 (PDT) Received: by 10.70.65.18 with HTTP; Wed, 26 Oct 2005 10:31:43 -0700 (PDT) Message-ID: Date: Wed, 26 Oct 2005 13:31:43 -0400 From: Ben Anderson To: users@cocoon.apache.org Subject: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10989_18502593.1130347903300" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_10989_18502593.1130347903300 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, 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: failed on form cocoon.log.debug("form returning false"); return false; action cocoon.log.debug("widget returning false"); return false; What's interesting is that both log messages are printed. However, if I change the on the form to return true then widget.isValid() returns true even though my action field still returns false. CForms online documentation for says to consult the examples in the source. I only found one example and it is directly under the form (not the widget). Question #1: This leads me to believe that maybe I can't put under the element? Also, the 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 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? Thanks, Ben ------=_Part_10989_18502593.1130347903300 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi,
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 &quo= t;invalidate" the form:

Here's my form definition:
  <fd:validation>
    <fd:javascript>
      <fd:failmessage>failed on form</fd:= failmessage>
      cocoon.log.debug("form returning false&= quot;);
      return false;
    </fd:javascript>
  </fd:validation>
  <fd:widgets>
    <fd:field id=3D"action">
      <fd:label>action</fd:label>
      <fd:datatype base=3D"string"/&g= t;
      <fd:validation>
        <fd:javascript>
          cocoon.log.debug(&qu= ot;widget returning false");
          return false;
        </fd:javascript>
      </fd:validation>
    </fd:field>

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 widget).

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

<fd:javascript>
  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?=
Thanks,
Ben
------=_Part_10989_18502593.1130347903300--