Expand my Community achievements bar.

Easy Scripting question

Avatar

Level 3

Is there such thing as too many scripts in a form?

I'm currently creating a form that has ~50 scripts attached to a single object. So far the form works beautifully.

I was just asked to expand the form dramatically. The scripts being used currently wouldn't differ much from any added, it would just be that it would be adding 300+ more scirpts to a single object. Not to mention a script here or there to about 300 or so items.

I guess what I want to know is, is this viable? Or will there be too many scripts, making the form non-functional?

2 Replies

Avatar

Level 10

Having too many scripts on the form can affect the performance of the form.. Instead of having the scripts written in each of the field in the dynamic section, place the same scripts in a Script Object and make a call from each field. That way source of the script will be at only one place.

Thanks

Srini

Avatar

Level 10

Hi,

You should have a look at John Brinkman's blog: http://blogs.adobe.com/formfeed/2010/02/big_and_complex_forms.html on this topic.

The number of scripts is one aspect, the main concern is what events are the scripts in. For example, layout:ready fire very often, so if you have a lot of objects with script in this event, performance is going to take a hammering. This is especially true when the form is dynamic, in that you are repeating instances of an object - as this fires the layout:ready event across all objects that have script in this event. Similarly calculate event will fire when objects referred to in the script change, therefore if a lot of objects are interlinked, it can have a cascading effect.

You may want to consider limiting the max number of times an object can be repeated.

I have an exercise in script events here: http://assurehsc.ie/blog/index.php/2010/05/how-often-events-fire-and-their-sequence/

Possibly consider using script objects and functions to make it easier to develop and maintain your script. EG one script accessed by different objects.

Niall