Ticket #400 (closed task: fixed)

Opened 2 years ago

Last modified 2 years ago

Disable element in case does not work for atomic element

Reported by: idbr Owned by: mpo
Priority: minor Milestone: 0.4
Component: modules/kauri-forms Version:
Keywords: Cc:

Description

In a case-control, disabling a composite in a case works, but if the case is a single element, it doesn't (in r1792).

For example, change the case-control sample as follows:

"cases": {
    "t" : {
        "base": "string",
        "label": "Text",
        "+validators": { "required": {} },
        "control": {
            "base": "input-control",
            "initial": {
              "value": "Enter text",
              "enable": false
            }
        }
    },
    "n" : {
        "base": "composite",
        "label": "Number",
        "control": {
            "initial": {
              "enable": false
            }
        },
        "members": {
            "test": "string",
            "test2": "integer"
        }
    }
}

You'll notice that for case Text, the input field is enabled, and for the Number case, both input fields are disabled.

Change History

comment:1 Changed 2 years ago by jgou

  • Milestone set to 0.4

comment:2 Changed 2 years ago by karel

  • Owner changed from mpo to karel
  • Status changed from new to assigned

More info:

  • When you add an initial value to the composite element, it isn't disabled either. (eg. value: {test:"hello", test2:10})
  • However, when you remove the initial value from the single element case the problem persists (i.e. it doesn't become disabled like the no-value composite)

comment:3 Changed 2 years ago by karel

(In [1799]) Resetting a case control should also reset its valueControls.

see #400.
This fixes the problem adressed in the main ticket's description, but another problem persists:
If you add an initial value to the AbstractContainerControl?, reset() is called on the composite case control,
causing it to be visible at startup.

comment:4 Changed 2 years ago by karel

  • Owner changed from karel to mpo

Ressigning to mpo for remaining problem. Please review this suggested fix:

http://dev.outerthought.org/trac/outerthought_kauri/browser/trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-%7Bbuild%7D.key/kauri.forms/control.js#L2286

Remove the if/else and leave these two lines (in this order):

Control.reset(me);
me.eachChild(AbstractContainerControl.childReset);

comment:5 Changed 2 years ago by jgou

r1799 causes #430 , which makes the case control practically unusable.
I suggest reverting this commit until a more complete fix is available.

comment:6 Changed 2 years ago by karel

  • Status changed from assigned to closed
  • Resolution set to fixed

In [1807]:

Properly reset & show/hide case control children.

fixes #400
fixes #430

Note: See TracTickets for help on using tickets.