Wednesday, April 05, 2006

Simplifying use of client script usage on a form

For those of you who read through the entire SDK this may not be news to you but in my latest perusal of the SDK I found a really cool function that I hadn't seen before.

It is the "FireOnChange()". Basically its used to fire the onChange of another field. Why would you ever use this? Well, if anyone asks you to have autocalculating fields you have to do the calculations for each field separately, or code for every case and then copy and paste it into every field on the form that is related to the calculation. Not too bad. But if you then realize that you programmed something incorrectly, or something needs to be changed, you have to go back and make the change to every field with the code in it.

Using the "FireOnChange()" command helps you manage your code SOOOO much better. Basically, you write your code in one field and have it handle every case for all of the other fields. Then you just have all the other fields reference the field with the code. When you update or change the code you only have to do it once because all of the other fields are looking to one place for your code.


That's it! Really simple but very helpful.

David Fronk
Dynamic Methods Inc.

No comments:

Post a Comment