cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reinhard Poetz <reinh...@apache.org>
Subject Re: WG: CFORMS validation unexplained behavior - call for help!
Date Mon, 06 Jun 2005 07:54:31 GMT
Messing, Elad wrote:

[snip the second mail]

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


This is the intended behaviour. The getValue() method of the widget

     public Object getValue() {
         ...
         return this.validationError == null ? this.value : null;
     }

only returns the value if there are *no* validation errors. I'm not sure if this 
is the correct or if we should make this configureable. Feel free to move the 
discussion over to dev@cocoon.apache.org to get opinions of other developers.

Maybe your form level validation should check if the two widgets have set 
validation errors.

> 
>         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 ?

because the complete widget tree is validated

> 
>         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 ?


How often are you hitting the back button?

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

which controller are you using? It seems to me that the controller isn't 
initializing your form correctly.

> 
>         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 :)
> 

[snip the sample]

-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------

	

	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message