function validate(formName,url) {
	//&struts.validateOnly=true bug pour l'instant
  	var kw = {
        url: url+"?struts.enableJSONValidation=true",
        preventCache: true,
        load: function(data) {
        	showValidation(formName, data);
        },
		error: function(err) {
			checkTransferError(err);
		},
        timeout: 10000,
        form: formName
	};
	dojo.xhrGet(kw);
  }
  
function showValidation(formName, data) {
	var form = dojo.byId(formName);
	//clear previous validation errors, if any
	//StrutsUtils.clearValidationErrors(form);
     
	//get errors from response
	var errorsObject = StrutsUtils.getValidationErrors(data);
	
	//show errors, if any
	if(errorsObject!=null && errorsObject.fieldErrors) {
		StrutsUtils.showValidationErrors(form, errorsObject);
/*
	 	//DEBUG :
		for(var fieldName in errorsObject.fieldErrors) {
			for(var i = 0; i < errorsObject.fieldErrors[fieldName].length; i++) {
				alert(errorsObject.fieldErrors[fieldName][i]);
			}
		}
*/
	} else {
		//good to go, regular submit
		validationSuccess(formName);
	}
}


function clearErrorMessages(form) {
    // get field table
}

function clearErrorMessagesCSS(form) {
	clearErrorMessages(form);
}

function clearErrorMessagesXHTML(form) {
	clearErrorMessages(form);
}


function clearErrorLabels(form) {
    //clear error labels
}

function clearErrorLabelsCSS(form) {
	clearErrorLabels(form);
}

function clearErrorLabelsXHTML(form) {
	clearErrorLabels(form);
}

function addError(e, errorText) {
   if(e!=null) {
   		
		if(e.getAttribute("id")!=null) {
			dijit.byId(e.id).displayMessage(errorText);
		} else {
			console.log("No id : "+errorText);
		}
   }
}


function addErrorXHTML(e, errorText) {
    addError(e, errorText);
}

function addErrorCSS(e, errorText) {
	addError(e, errorText);
    /*try {
        // clear out any rows with an "errorFor" of e.id
        var row = e.parentNode.parentNode;
        var table = row.parentNode;
        var error = document.createTextNode(errorText);
        var tr = document.createElement("tr");
        var td = document.createElement("td");
        var span = document.createElement("span");
        td.align = "center";
        td.valign = "top";
        td.colSpan = 2;
        span.setAttribute("class", "errorMessage");
        span.setAttribute("className", "errorMessage"); //ie hack cause ie does not support setAttribute
        span.appendChild(error);
        td.appendChild(span);
        tr.appendChild(td);
        tr.setAttribute("errorFor", e.id);;
        table.insertBefore(tr, row);

        // update the label too
        //if labelposition is 'top' the label is on the row above
        var labelRow = row.cells.length > 1 ? row : StrutsUtils.previousElement(tr, "tr");
        var label = labelRow.cells[0].getElementsByTagName("label")[0];
        label.setAttribute("class", "errorLabel");
        label.setAttribute("className", "errorLabel"); //ie hack cause ie does not support setAttribute
    } catch (e) {
        alert(e);
    }*/
}
