cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Messing, Elad" <>
Subject WG: CFORMS validation unexplained behavior - call for help!
Date Mon, 06 Jun 2005 07:18:51 GMT
Hi All !
    I have posted this message last week - with no response :( . I am
actually quite surprised that no one got the same results from using
CFORMS as I am only using it in a very basic manner. 
    This issue is really a pain, and I cannot keep implementing my
project when forms validation do not work as expected. 
    Can you please take a minute of your time and try to point me to the
right direction ?
    Thank you in advance!


Von: Messing, Elad 
Gesendet: Donnerstag, 2. Juni 2005 17:54
Betreff: CFORMS validation unexplained behavior 

Hello again ! 
        I have posted this text 24 hours ago, but it seems like it was
too related to its previous thread, so I decided to repost it as a new
thread with a new title. Forgive me if you consider this as spam.

        With the help of Sylvain and Thorsten I have managed to come up
with a form. 
        Now - when all data is valid, all works fine. 
        The problem starts when the data is not valid. 

        I have 3 widgets in my form - text field and a select list. (See
definition below) 
        On the text field there is a validation of length, and on the
select list there is no validation, but the first "item" of it is a null
record - to show an empty slot.

        On the "form" there is a validation so that either of the 2
fields must contain value. (See definition below) 

        When I first show the form all is fine. 

        When I enter a too-short string in the text field, I get a
strange behavior: I can see the error message stating it is too short,
but I can also see the error message stating that either of the fields
should be entered (coming from the "form level" validation function) -
like nothing was entered in the text field. I added a "print" line into
the form validation, to see that even though I have entered a value in
the text field (it was too short - but it was there) the widget value is
actually null. (see the "print" in the flow below).

        Also - I would expect the validation to stop after it was
failing on the "too-short" text field widget validation. Why has it
continued to the "Form level" validation at all ?

        Another strange behavior was, that after I submitted the form
with valid data, I could see the results. When I pressed "Back" button
of the browser - I got back to the form page, with all the error
messages still showing. The fields are showing the valid data which I
put in, but the errors from the first trail are still there. Why is that

        And the third issue - When I am not using the "Back" button, but
instead using the original "link" to the form page, I get other results
- I can see the form in the state it was after I entered a "too-short"
string in the text field !! This is after I have already changed the
data to valid, submitted, got my results, and return to the form page
using its link 1 minute after.. I even get the results opening a new
browser window, in a different process. Only "restart" to the web server
removes it.

        Is this the normal behavior ? Should I reset the form in some
manner ? 

        I am attaching down the needed text from the flow and form
description - maybe it can help you understand my problems.

        Thank you very much for reading my long post :) 



        <fd:messages id="errors"> 
                <fd:datatype base="string"/> 
    <fd:field id="name"> 
      <fd:hint>Hint Hint</fd:hint> 
      <fd:datatype base="string"/> 
        <fd:length min="2"> 
                <fd:failmessage>You should add name</fd:failmessage> 

    <fd:field id="type"> 
      <fd:datatype base="integer"/> 
      <fd:selection-list type="flow-jxpath" list-path="restTypeList"
value-path="id" label-path="name"/> 


function validateRestaurantForm (form){ 
        print ("Start validateRestaurantForm"); 
        var success = true; 
        var nameWidget = form.lookupWidget("name"); 
        var typeWidget = form.lookupWidget("type"); 
        var errorsWidget = form.lookupWidget("errors"); 

        print ("Name: " + nameWidget.value + " Type: " +
        if (typeWidget.value == null && nameWidget.value == null ) { 
                errorsWidget.addMessage("You must either select a name
or type"); 
                print ("set the errors and return false"); 
        success = false; 
        return success; 


Elad Messing 
Software Developer 
European Media Laboratory GmbH 
Schloss-Wolfsbrunnenweg 33 
D-69118 Heidelberg 

View raw message