Aron Shamash wrote:
> Hi Simone
>  
> Thanks very much for your reply.
>  
> I have tried *widget.value.length* ,

...but did you try widget.value.length() like Simone suggested?

widget.value will return you a java.lang.String object.  From there you
 can just follow the standard java.lang.String API, for instance call
the length() method to get the number of characters.

> but when I print this to the
> console it prints:
>  
> 10:17:55,817 INFO [STDOUT] function length() {/*
> 
> int length()
> 
> */}
> 
> It looks like the content is commented out.
>  
> Any idea why that should be?

This is just the JavaScript interpreter's way of representing the
java.lang.String.length() method as a string.  The bit that's commented
out is simply the method signature, telling you what arguments are
expected and what will be returned.

> How can I edit this length() function
>  
>  
> 
>     Hi Aron,
>     yes, AFAIK there is no widget.length, you should use
>     widget.getValue().length() in java, maybe widget.getValue().length
>     or widget.value.length in javascript.
> 
>     Hope this helps,
>     Simone
> 
> 
>     Aron Shamash wrote:
>>
>>     Hi
>>
>>     Up until now I have always validated length of string widget
>>     using  <fd:length> eg:
>>
>>                     <fd:length min="4" max="60">
>>                        
>>     
>> <fd:failmessage><i18n:text>slb.addressOneSecondApplicant.length</i18n:text></fd:failmessage>
>>                     </fd:length> 
>>
>>     In this (new) case I only want this validation to be executed
>>     depending on the value of another widget therefore I wanted to use
>>     server-side javascript to find the widget's length.
>>
>>     This does not appear to be working for me though.
>>
>>     widget.length is undefined.
>>
>>     Is this possible? Is there another way around this problem?
>>
>>      
>>
>>      
>>
>>     Aron Shamash
>>
>>     Interface Developer
>>
>>     Phone 020 7907 4545
>>
>>     *DNA *An Avenue A | Razorfish Company
>>
>>     _www.dna.co.uk_
>>
>>      
>     -- 
>     Simone Gianni


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to