cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens Maukisch" <>
Subject CForms fd:javascript validation problem (validating two widgets against each other)
Date Mon, 12 Jul 2004 07:39:52 GMT

I have two field widgets (datatype date) in my form
and I want to validate them against each other with
some javascript code.

The validation rule for the first widget is, that the
date must be after today and the js-code looks like this:
var error = true;
var value = widget.value;
var today = new;
if(today.after(value)) {
	widget.setValidationError(new	("errormsg",
	error = false;				
return error;		

The date of the second widget must be after the date of the first widget.
The js-code looks like this (it might work with fd:assert as well, but it
should not matter atm);
var error = true;
var value = widget.value;
var parent = widget.getForm();
var widget1 = parent.lookupWidget("widget1");			
var value2 = widget1.getValue();
if(value.before(value2)) {
	error = false;
return error;

The problem is that if the first widget is not valid and i want to validate
the second widget, the 
value of widget1 (widget1.getValue()) is always null.

The validation of the second widget works fine if the validation of the
first widget is ok.

Thanks for your help in advance,

kind regards

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

View raw message