ZK 6 MVVM Introduces New Must Have Feature “Form Binding” Keeping Dirty Data Away From Developers

Share Article

ZK MVVM's "form binding" feature provides a mechanism that is able to validate user input twice at different time frames, keeping dirty data away from developers and reducing maintenance burden.

ZK Logo


ZK MVVM's "form binding" feature provides a mechanism that is able to validate user input twice at different time frames

In MVVM, there are usually two conventional saving resorts; saving on change or saving on user action which is a general idea derived from that of Microsoft WPF. For example, when creating an online form, users fill out the form by completing each required fields in the form. With this, validation of input value needs to be executed to ensure that the user has filled in the correct data for each of the fields before confirmation. In the case of “saving on change”, user input is validated immediately for a single field as they enter the data. On the other hand, “saving on user action” describes a pattern in which every field is validated once at the end of the action when user has finished filling out the form and sends for confirmation. This method avoids saving a new item with invalid value but at the same time it also means that if the user enters an invalid value, they won’t get an error message immediately as they continue to fill in the next fields.

Generally, this should be sufficient; developers either pick one way or another to perform the validation. However, under certain circumstances, there are times when developers wishes to store temporary user input before user confirmation without contaminating the real data. To resolve this, ZK team invented a mechanism that is able to validate input twice at different time frames. ZK MVVM’s “form binding” feature provides a way which enables the validation of a single field immediately after users enter the input value and then validates it once again when confirmation is being sent.

This is done by the introduction of a middle object which contains duplicated properties of the original object and plays a role like a cache. Before user sends in the confirmation, ZK saves the input data into the middle object instead of the real target object, invoking the validation of that field and as a result achieves immediate validation of a single field. Next, when confirmation is sent by the user, it then saves those data into the real target object. In cases where users cancel their modification, there is also no need for developers to clear the dirty data from target object thus reducing maintenance burden.

To check out how this feature works and implemented in detail, please refer to the following small talk or download ZK 6 to try out this amazing feature!

About Potix
Potix Corporation develops and supports ZK, the #1 Java based Ajax solution on SourceForge.net, the world's largest open source host. Innovation is the most driving force behind the growing Potix. Potix delivered the first Ajax framework to support Java and Android phones, the first embeddable Ajax spreadsheet, and the first to synergize the power of pure Java, markup and scripting languages.

ZK has more than 1,500,000 downloads since its first release in late 2005. ZK is deployed by a large number of Fortune Global 500 companies, including Barclays, Societe Generale, Swiss RE, eBay, Roche, Deutsche Bank, Sony, Sun Microsystems, Audi, EMC and Toyota, providing them with the ability to rapidly create rich Ajax enterprise level applications.

Share article on social media or email:

View article via:

Pdf Print

Contact Author

Nancy Lin
Visit website