You can embed calculations and scripts in a form design to execute calculations, methods, or operations when any of an object’s events occur at run time. For example, an event occurs at run time when the user performs the action that the event specifies. You can call any of an object’s supported methods and examine or set properties by defining a script.
In LiveCycle Designer ES, scripts and calculations are designated, by default, to run on the client device. The default processing location is defined in the Preview tab of the Form Properties dialog box (select Edit > Form Properties). To override the default processing location, you can explicitly specify a different processing location by using the Run At option in the Script Editor when you attach a script or calculation to an object.
When you have LiveCycle Forms ES, processing can be done on the client, the server, or both. When you specify that a script/calculation is to run on the client and server, the client and server may both attempt to run the script/calculation. LiveCycle Forms ES always attempts to process the script/calculation if the client cannot do so. If you designate scripts/calculations to run on the server, LiveCycle Forms ES runs the scripts and/or calculations, remerges the results into the form, and returns both to the client.
Client-side scripts and calculations are run on the client device. When creating PDF forms for Acrobat or Adobe Reader, all processing must be done on the client. However, if the client cannot run the script or calculation, LiveCycle Forms ES will attempt to process the script or calculation.
See also 

Where calculations and scripts are run