cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <baskar.gan...@wipro.com>
Subject [CForms] widget validation
Date Wed, 24 Nov 2004 09:22:54 GMT

Hi,

I want to validate all the field widgets with their 'required '
attribute set to true.

For that I have a <fd:javascript> snippet which calls a function written
in flowscript.

Following is the snippet in my form definition file: -

  <fd:submit id="submit" action-command="submit form">
   <fd:on-action>
     <fd:javascript>
       validateRequired(event.source.parent);
    </fd:javascript>
   </fd:on-action>
 </fd:submit>

And this is what I have in my flowscript: -

function validateRequired(wid) {

  print("Calling validateRequired");
  print("get children " + wid.getChildren());
 
  var widIter = wid.getChildren();
  
  while (widIter.hasNext()) {
    var widObj = widIter.next();
   
	print("Widgets are "+ widObj.getValue() + " Is required " +
widObj.isRequired());
    
	if (widObj.isRequired && widObj.getValue() == null) {
     
      widObj.setValidationError(new
Packages.org.apache.cocoon.forms.validation.ValidationError("Please
enter a value for the required field"));
    }
 }
}

The above code throws an error as follows: -

setValidationError is not a function.

I browsed the Cocoon API. I can see that setValidation Error is a method
in the Field Class of the FormModel package.

Can anyone help me in pointing out what could be wrong in the above
code.

Cheers
Baskar



Confidentiality Notice

The information contained in this electronic message and any attachments to this message are
intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information.
If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com
immediately
and destroy all copies of this message and any attachments.

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


Mime
View raw message