You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by an...@wipro.com on 2004/07/20 13:53:03 UTC

Set Validation Error

Hi,

I want to set a Validation Error for a form widget. I am able to do it
when I use formWidObj.widName.onActivate = test(formWidObj);


But when I use the following I am unsuccessful in setting the validation
error.

if(formObjWid.getSubmitWidget().equals(formObjWid.widName))
	test();

Where test() is
test(formWidObj) {
	return function() {
		formWidObj.widName.setValidationError("Error")'
		return false;
	}
}
widName is a 'submit' widget.

Is it that validation errors can be set only when we use onActivate.
Or is it that I am trying to set validation error in a wrong way when I
use getSubmitWidget()?

Thanks in advance.

Regards,
Anand

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


Re: Set Validation Error

Posted by Bruno Dumon <br...@outerthought.org>.
On Tue, 2004-07-20 at 13:53, anand.vasudevan@wipro.com wrote:
> Hi,
> 
> I want to set a Validation Error for a form widget. I am able to do it
> when I use formWidObj.widName.onActivate = test(formWidObj);
> 
> 
> But when I use the following I am unsuccessful in setting the validation
> error.
> 
> if(formObjWid.getSubmitWidget().equals(formObjWid.widName))
> 	test();
> 
> Where test() is
> test(formWidObj) {
> 	return function() {
> 		formWidObj.widName.setValidationError("Error")'
> 		return false;
> 	}
> }
> widName is a 'submit' widget.
> 
> Is it that validation errors can be set only when we use onActivate.
> Or is it that I am trying to set validation error in a wrong way when I
> use getSubmitWidget()?

The method test expects a parameter formWidObj but you call it without a
parameter.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


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


Re: Set Validation Error

Posted by Olivier Billard <ob...@jouve.fr>.
Hi Anand,

The widget.setValidationError() takes a ValidationError object, and not 
a string [1].
You should try this :

formWidObj.widName.setValidationError(
     new 
Packages.org.apache.cocoon.woody.datatype.ValidationError("Error"));


[1] 
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/formmodel/Field.html#setValidationError(org.apache.cocoon.forms.validation.ValidationError)

--
Olivier Billard

anand.vasudevan@wipro.com wrote:

> Hi,
> 
> I want to set a Validation Error for a form widget. I am able to do it
> when I use formWidObj.widName.onActivate = test(formWidObj);
> 
> 
> But when I use the following I am unsuccessful in setting the validation
> error.
> 
> if(formObjWid.getSubmitWidget().equals(formObjWid.widName))
> 	test();
> 
> Where test() is
> 
> test(formWidObj) {
> 	return function() {
> 		formWidObj.widName.setValidationError("Error")'
> 		return false;
> 	}
> }
> widName is a 'submit' widget.
> 
> Is it that validation errors can be set only when we use onActivate.
> Or is it that I am trying to set validation error in a wrong way when I
> use getSubmitWidget()?
> 
> Thanks in advance.
> 
> Regards,
> Anand
> 
> 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