cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "maisonneuve nico" <>
Subject woody dynamic validation rule
Date Thu, 31 Jul 2003 02:15:57 GMT
hi , i would make a account form with woody and store informations in a xml 
file (in fact in a XML database)
with this structure :

in the create action, at the end of the submit, i have to check if the login 
is already used or not.
i cant create a validation rule despit of the update action  (in update 
action, the login check will be always true and a validation error will be 
so i make a avalon XMLDBcomponent with the hasResult(Xpath)
and update the file.js with this source code;
but how tell to the user the invalide login error (with validate rule it's 
easy but with this way i don't know how do)

or can we create a dynamic validatation rule

thank in advance

cocoon.load("resource://org/apache/cocoon/woody/flow/javascript/woody.js") ;
cocoon.load("flow/xmldb.js") ;

var display_pipeline = "account-display" ;
var sucess_pipeline = "account-sucess" ;
var collectionDB = "xmldb:xindice://localhost:8080/db/user" ;
var documentID;
var document;
var action;

function account(form) {


	if (action=="update")	{
		//  bind the form with the document with the ID
		document = loadDocument(documentID,collectionDB);

	// shows the form to the user until is validated successfully, formHandler);

	// bind the form's data back to the document;

    // save the DOM-tree
	if (action=="update")
		updateDocument(document, documentID,collectionDB);
	if (action=="create")
		 addDocument(document, documentID,collectionDB)




function formHandler(form) {
    var model = form.getModel();
	if (verify(model))
		return true;
		return false;


function verify(model) {

	// create a ID if the id is null
	if ( == null)

	// init the user role  if it is null
	if (model.role ==null)
	if (action=="create")
		var results=xmldb.hasResults("//user[login='"+model.login+"' and 
		return (!results);
	else return true;

MSN Messenger 6 : ajoutez une image à votre 
pseudo pour dialoguer avec vos amis

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message