You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Form models are a central feature of Qookery. They can be used to populate form fields but also serve to control business logic such as visibility, enabled state etc. In order to decrease script tag noise and to enhance the visibility of this feature, I propose to add syntax that declares the initial state of the model and allows to bind the model properties to widgets and to other properties. Something like (here with a somewhat contrived example):
It would initialize two model properties, editorContent (String) and editorVisible(Boolean)
It would enable or disable the "Save" button dependent on whether the editor contains text
It would show or hide the editor and the button dependent on whether the editorVisible model property is true
It would set the content of the editor dependent on the change of the editorVisible property (this doesn't make much sense, just as an example)
The "target" attribute in the node could differentiate between Qookery ids using the hash sign ("#rightEditor") and other properties in the model (without hash sign), making connections within the model easy. This would be handy for access control in widgets. For example, one model property determines the "enabled" status of multiple form widgets, and is, in turn, dependent on the state of another property, but needs to be converted/transformed first.
An expressive syntax like the one above would make this interdependency very readable. Maybe the converter function should therefore have access to the model, although this introduces side-effects.
The text was updated successfully, but these errors were encountered:
Is this something you are considering to implement? I think it would make writing self-contained forms much easier - putting this kind of logid into script tag is ugly and error-prone...
Form models are a central feature of Qookery. They can be used to populate form fields but also serve to control business logic such as visibility, enabled state etc. In order to decrease script tag noise and to enhance the visibility of this feature, I propose to add syntax that declares the initial state of the model and allows to bind the model properties to widgets and to other properties. Something like (here with a somewhat contrived example):
This would do the following:
editorContent
(String) andeditorVisible
(Boolean)editorVisible
model property is trueeditorVisible
property (this doesn't make much sense, just as an example)The "target" attribute in the node could differentiate between Qookery ids using the hash sign ("#rightEditor") and other properties in the model (without hash sign), making connections within the model easy. This would be handy for access control in widgets. For example, one model property determines the "enabled" status of multiple form widgets, and is, in turn, dependent on the state of another property, but needs to be converted/transformed first.
An expressive syntax like the one above would make this interdependency very readable. Maybe the converter function should therefore have access to the model, although this introduces side-effects.
The text was updated successfully, but these errors were encountered: