cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robby Pelssers, AGP" <>
Subject RE: validation
Date Wed, 20 Dec 2006 11:11:53 GMT
Hi Roel,
you could in javascript ask your form to validate itself....
suppose we have something like 
var form = new Form("userform.xml");

var formWidget = form.form;

suppose now your formWidget has a field with id="validationError"
then you could write in your while(true) loop something like
if ("save-data".equals(form.submitId)) {

    if (!formWidget.isValid()) {

        formWidget.lookupWidget("validationError").setValue("There was a
problem validating your form");



Robby Pelssers


Van: Roel Croonenberghs [] 
Verzonden: woensdag 20 december 2006 11:43
Onderwerp: Re: validation


I use the required attribute. And I get a  !  next to the filed. When I
click that   !   then I get to see te message. But I want to (next to this
behaviour ) that i can display a message at the bottom of my form to tell
the user that the form did not validate. (because users tend to oversee
these   !      even when they are in red) 

so is it possible to check that at least 1 (one) field is not validated (it
doesn't matter witch) and then show a message? 


situation now after submit; 

field1   myname        * 
field2   myadres * 
field3                * !         
field4   mytelephone * 

* required 

situation wanted after submit 

field1   myname        * 
field2   myadres * 
field3                * !         
field4   mytelephone * 

* required 

There was a problem validating your form 


"bart remmerie" <> 

20/12/2006 11:33 

Please respond to



Re: validation


Dear Roel,

In your form-definition, you can declare whether or not a field is required:
<fd:field id="..." required="true|false" state="...">

When a field has required="true", a message is displayed when the
field is not filled out (on form-submit) (when using standard

Next to that, fields that have the required="true" attribute, are
marked and a ! appears displaying the validation error (after
attempted submission)


2006/12/19, Roel Croonenberghs <>:
> Hello,
> I'm using cocoon widgets. I have a form with different widgets. Some are
> required, not all. How can I show one message if one of the required
> is not filled in?
> tnx
> Roel

Bart Remmerie

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

View raw message