Get size of Multi Form with Pictures Object Array

06 Jun '14, 01:18 AM
16,927 Views
No Forum Badges

In my project I have a Multi Form that I use to upload pictures. However, there needs to be a restriction to the amount of pictures a user can add. This amount needs to be min. 1 and max. 10. Now when pressing the 'submit' button, an OK flow goes to a Scrip Unit with as input the Pictures object. Inside the Script Unit I have the following piece of code:

#input Object[] pictures

if((pictures.length == 0) || (pictures.length > 10)){
    return ["resultCode":"error"]
} else {
    return ["resultCode":"success"]
}

However, this is not working since it always returns 'success'.

Hope someone can help me out here.
 

 
x 0
Follow
Answer Answer at this question and get points!
Forum Starter - Level 2

Hi Jef,

try printing some information with your script, for example like this:

println "length: "+pictures.length

In this way you'll see the printed information in the console of tomcat and you can debug your code.

 

I hope this helps!

 
x 0
Answer at this question and get points!