O'Reilly logo

Easy Web Development with WaveMaker by Edward Callahan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting and getting values

The getting and setting of values is very common in JavaScript page functions. Whether it is to validate user input, assemble input values to service calls, or generate messages and summaries, page code often reads and writes component values. It is best practice to use setters and getters whenever available. Getters and setters are the functions that get and set values on an object. They almost always use set and get in their name, such as getDataValue(), setCaption(), and setDataValue(). The use of getters, and especially setters, instead of performing an assignment ensures that change notifications and any required refreshing of the component takes place.

Take, for example, a label named labelTitle. We might be tempted ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required