cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From beya! <and...@jibeya.com>
Subject Re: Nested Widget Validation...
Date Tue, 16 Nov 2004 15:09:57 GMT
Jorg,
here you go ;-)

<?xml version="1.0"?>

<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
<fd:validation>
   	<fd:javascript>
   		var success = true;
   		var items = neworder;
   		var quantity = widget.lookupWidget("quantity");
   		if (items.getOrderItems() == null &amp;&amp; quantity.value ==  
null) {
   			quantity.setValidationError(new  
Packages.org.apache.cocoon.forms.validation.ValidationError("Please  
enter a value", false));
   			success = false;
   		}
   		return success;
   	</fd:javascript>
</fd:validation>

<fd:widgets>
     <fd:field id="quantity">
       <fd:label>Quantity</fd:label>
       <fd:datatype base="integer"/>
     </fd:field>
</fd:widgets>

</fd:form>

regards

Andrew


On 16 Nov 2004, at 14:37, Jorg Heymans wrote:

> No worries :)
>
> Care to contribute your solution to the list maybe?
>
> Regards
> Jorg
>
> beya! wrote:
>> Problem solved......
>> thanks for your help
>> regards
>> Andrew
>> On 16 Nov 2004, at 12:41, beya! wrote:
>>     Hi,
>>     I have created a widget as so:
>>     <fd:widgets>
>>     <fd:field id="quantity">
>>     <fd:label>Quantity</fd:label>
>>     <fd:datatype base="integer"/>
>>     </fd:field>
>>     </fd:widgets>
>>     Quantity is an attribute of an orderitem, so what I want the
>>     validation to do is:
>>     1. If neworder.getOrderItems() is null, submit the form only if  
>> the
>>     quantity field has an integer value.
>>     2. If neworder.getOrderItems() is not null, submit the form if
>>     quantity has an integer value or not.
>>     How do I represent this in my widget definition?
>>     many thanks
>>     Andrew
>> ---------------------------------------------------------------------- 
>> --
>> * +The home of urban music
>> + http://www.beyarecords.com
>> *
>> ---------------------------------------------------------------------- 
>> --
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Mime
View raw message