The Kinetic Platform is a flexible tool used to create and maintain Business Solutions for a multitude of industries and applications. As such, there is often no one correct answer to architecture and development decisions made in the process of creating or maintaining said solutions. The answers to these decisions depend on many factors including current and future scale and growth potential, both of customer base and development staff, technical specifications for the solution, and more. To address the need to answer these questions that do not have a simple answer, we have created this Examining Best Practices series of articles.
This article examines how best to manage the display (show/hide) for the fields on forms.
The Kinetic Form builder allows for conditional display or validation of a field. This means that variables such as other field values, form attributes, whether the form is in review, etc can be used to determine if the field is to be displayed. This is evaluated automatically whenever there is a change on the submission to any of the values.
K('field[Field Name]').hide() K('field[Field Name]').show() K('field[Field Name]').disable() K('field[Field Name]').enable()
Given that the similar functionality could be acquired by having a particular field on those shared forms and setting that field to a value that, per the built in conditional, controls the display in the desired way, there is little to be said for this method unless it is something where the conditional is likely to be updated frequently. Then this method could prevent you from having to go into all the forms to update the conditional.