cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Messing, Elad" <elad.mess...@eml-d.villa-bosch.de>
Subject WG: Validation errors behavior in CForms
Date Mon, 04 Jul 2005 11:32:09 GMT
Hello all
	This is an issue I couldn't get an answer to in the dev mailing list.
	I thought as it might be an "in-depth" issue maybe this is more development related, so I
thought I will post it here as well.

	I am sorry if this is "Spam" for you. If so - please let me know and ignore it.

	Thank you !

Elad

-----Urspr√ľngliche Nachricht-----
Von: Messing, Elad 
Gesendet: Dienstag, 21. Juni 2005 15:39
An: users@cocoon.apache.org
Betreff: Validation errors behavior in CForms

Hello all
	This question has been asked before, but I couldn't find a definitive answer :

	I have a Cform with validation in 1 field:



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

	Also , the form validation is being done in a JS function :

  <fd:validation>
	<fd:javascript>
		validateRestaurantForm(widget);
	</fd:javascript>    
  </fd:validation>

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

	if (nameWidget.getValidationError() == null &&
typeWidget.getValidationError() == null){
	  	if (typeWidget.value == null && nameWidget.value == null
) {
			errorsWidget.addMessage("You must either select a name or type");
	      	success = false;
		}
	}
	return success;
}
	

	The form is being called from a FlowScript:

function handleForm (){
	var form = new Form("forms/restaurant_main_search.xml");
	form.showForm("/template/forms/restaurant_main_search.xhtml",
data);
	...




	My problem is , that whenever I test the form, 	and make a
mistake (invalid string)- the error message (along with the invalid
value) stays on the form whatever I do. I press the link for the form again, I close the browser,
I open a new different browser application.
Nothing. 

	Only when I restart the web-server it is gone, and the form is "clean" again.
	I checked, and it is not "Caching". The actual FlowScript is called every time.

	What could be the problem ?

	Thank you !


Elad


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



Mime
View raw message