Ticket #212 (closed enhancement: fixed)
Forms: make it possible to set operationalState (enabled/disabled) in fconf
| Reported by: | bruno | Owned by: | mpo |
|---|---|---|---|
| Priority: | critical | Milestone: | 0.4 |
| Component: | modules/kauri-forms | Version: | trunk |
| Keywords: | Cc: |
Description
See summary.
While at it, we should probably verify the implementation of the enable/disable methods for some kinds of controls.
Change History
comment:2 follow-up: ↓ 3 Changed 4 years ago by jgou
feature added by mpo in r1363
Some remarks:
- the initial block is a property of the control (hence should be placed in the control section in the form config. While this is the logical place considering the forms model, it might be more logical to users to place it a level higher in the config
- "disabled" attribute on the corresponding html input field is removed by the init function. By keeping and using this attribute, the above point (user convenience) loses importance.
And a minor bug: by disabling (via form config) a control, the following controls (of the same type) are also disabled. Looks like the inital object in base- and newconstructor are linked.
comment:4 Changed 4 years ago by mpo
important remark though:
These 'initial' settings are part of the control, not the type.
Regarding ease of configuration we should maybe consider to provide future support to add dis-or-enabled/shown attributes in the html-template to be picked up during initElements (and then override the initial settings in fconf?)
comment:5 Changed 3 years ago by mpo
Remaining work is thus:
- decide how to encode these settings into the HTML
suggested: checking up on existing HTML attributes controlling these:
- http://www.w3schools.com/TAGS/att_input_value.asp @value for initial.value,
- http://www.w3schools.com/TAGS/att_input_disabled.asp @disabled for initial.enabled
- http://www.w3schools.com/TAGS/att_input_type.asp @type='hidden' for initial.show)
- extend the current routine for implicit fconf reading to include these properties
comment:7 Changed 3 years ago by freya
setting the initial options should be possible since r1477
via attributes "value", "enable", "show"
comment:9 Changed 3 years ago by freya
attributes defined in HTml templates should be value="somevalue", disabled="disabled" or type="hidden" for resp initial value, enabled=false and show=false (and not enable/show as mentioned above)
since r1498 it is possible to add this initial properties via HTML while control and/or fieldType are defined via fconf
example:
var fconf = {
members: {
'name': 'string'
}
<input kauri-idref="name" kauri-role="input" value="test" disabled="disabled"/>
Thinking about this further:
This resembles the resently added initialValue in a number of ways
Given that similarity we could introduce an initialEnabled property and let it be picked up in the reset.
But maybe this suggests we reorganize things a bit into:
I know it breaks with the earlier introduced syntax for initialValue, but given that was not in a release yet I'ld prefer this more future-ready notation...
wdyt?