cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Billard <obill...@jouve.fr>
Subject Re: Set Validation Error
Date Wed, 21 Jul 2004 09:34:48 GMT
anand.vasudevan@wipro.com wrote:

> Hi Olivier,
> 
> Even when I give a string it works.

Sorry,

My fault, I looked at the woody classes, and that's true that the CForms 
flowscript wrapper can take an Object with setValidationError.


> But my doubt was whether
> setValidationError works when I use the below code to get the submit
> event of the form and perform validation
> 
> --> if(formObjWid.getSubmitWidget().equals(formObjWid.widName))
> 	test();
> 
> For me the above method didn't work. I had to use onActivate for the
> submit widget and set the validation error.
> So my question can validation errors be set only when we use onActivate
> for the submit widgets.

Since I'm not familiar with the CForms enhancement, I can't help you 
further.

But I don't understand why you want to add a validation error on a 
submit widget, instead of setting it to the field that causes the error 
to happen with it's bad value...

--
Olivier Billard


> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of Olivier Billard
> Sent: Wednesday, July 21, 2004 1:21 PM
> To: users@cocoon.apache.org
> Subject: Re: Set Validation Error
> 
> 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/F
> ield.html#setValidationError(org.apache.cocoon.forms.validation.Validati
> onError)
> 
> --
> 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


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


Mime
View raw message