formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

Disable Logic not working on checkboxes

Open rishabh47 opened this issue 8 years ago • 21 comments

I added a logic on checkbox for it to get disabled and enabled based on another checkbox. It was working fine earlier. After your update the logic is not working.

rishabh47 avatar Nov 28 '18 05:11 rishabh47

Which update broke the functionality? Can you provide the version where it no longer works? It also helps to provide a jsfiddle showing the issue.

travist avatar Nov 28 '18 15:11 travist

It was working earlier but when I upgraded the library to version 3.6 the disable logic stopped working on check boxes. I can't provide the code.

rishabh47 avatar Dec 04 '18 06:12 rishabh47

Can you provide a demo form where this is not working?

randallknutson avatar Dec 04 '18 15:12 randallknutson

@travist @randallknutson hello i face the same issue please see the below videos : https://drive.google.com/file/d/16Zy9ZyhuuGTcmoM2_33rPPxnx3c7mtbb/view?usp=sharing

https://drive.google.com/file/d/1zSg4uHl3zqMASgMjlIFmnWPeFc6Ucz5v/view?usp=sharing

AnasHijazi avatar Dec 12 '18 08:12 AnasHijazi

Thanks for the info. We'll take a look.

randallknutson avatar Dec 12 '18 15:12 randallknutson

@travist @randallknutson Hey, is this done yet?

rishabh47 avatar Dec 17 '18 05:12 rishabh47

@travist @randallknutson Any follow up here?

rishabh47 avatar Jan 07 '19 10:01 rishabh47

This issue is currently on one of our developer's list. We will let you know once this issue is resolved.

Thanks!

wag110894 avatar Jan 07 '19 16:01 wag110894

For me it looks field logic is not working anymore at all, it just hides the component when field logic is attached. I remember too, it worked in summer time :-)

krixerx avatar Jan 14 '19 10:01 krixerx

I am facing the same issue. Any update or workaround for the same? @travist @randallknutson @wag110894

ranjanasisodia avatar Jan 24 '19 10:01 ranjanasisodia

Here is an example of field logic working.

http://formio.github.io/formio.js/app/examples/fieldLogic.html

It must have something to do with your specific logic configurations. Can you provide the specific configurations that you have?

travist avatar Jan 24 '19 15:01 travist

@travist Could you please give another configuration where -> we have 2 checkbox, named one and two. when I un-check checkbox one, checkbox two is disabled.

ranjanasisodia avatar Jan 25 '19 05:01 ranjanasisodia

@travist

{ "_id": "5c4ad3f8eabd074156db9874", "type": "form", "tags": [], "owner": "5c4aca396faee6838fc867a2", "components": [ { "autofocus": false, "input": true, "inputType": "checkbox", "tableView": true, "label": "one", "dataGridLabel": false, "key": "one", "defaultValue": false, "protected": false, "persistent": true, "hidden": false, "name": "", "value": "", "clearOnHide": true, "validate": { "required": false }, "type": "checkbox", "labelPosition": "right", "hideLabel": false, "tags": [], "conditional": { "show": "", "when": null, "eq": "" }, "properties": {} }, { "autofocus": false, "input": true, "inputType": "checkbox", "tableView": true, "label": "two", "dataGridLabel": false, "key": "two", "defaultValue": false, "protected": false, "persistent": true, "hidden": false, "name": "", "value": "", "clearOnHide": true, "validate": { "required": false }, "type": "checkbox", "labelPosition": "right", "hideLabel": false, "tags": [], "conditional": { "show": "true", "when": "one", "eq": "true" }, "properties": {} } ], "revisions": "", "_vid": 0, "title": "checkbox test", "display": "form", "access": [ { "roles": [ "5c4aca4aa3e8afa2afe0e4e2", "5c4aca4aa3e8af0e06e0e4e3", "5c4aca4aa3e8aff7ace0e4e4" ], "type": "read_all" } ], "submissionAccess": [], "settings": {}, "name": "checkboxTest", "path": "checkboxtest", "project": "5c4aca4aa3e8af7b8ee0e4e1", "created": "2019-01-25T09:16:40.292Z", "modified": "2019-01-25T09:23:41.312Z", "machineName": "wnscbooqzizxjtm:checkboxTest" }

In the above code I have created 2 checkboxes named one and two. As per the logic, two should show true when one is true. But when logic is added to checkbox two, it gets hidden.

Have a look at this link for the demo.

https://formview.io/#/wnscbooqzizxjtm/checkboxtest?header=1

ranjanasisodia avatar Jan 25 '19 09:01 ranjanasisodia

The logic will not work in the FormView application since that is an Angular 1.x renderer. Try it here...

https://formio.github.io/formio-viewer/dist/#/wnscbooqzizxjtm/checkboxtest

That is your form rendered using our core renderer.

travist avatar Jan 25 '19 15:01 travist

@travist I tried another config at here: http://formio.github.io/formio.js/app/builder It should enable checkbox two when checkbox one has value true. But it just renders checkbox one. See the screenshot and JSON below:

output JSON:

{ "display": "form", "components": [ { "label": "one", "shortcut": "", "mask": false, "tableView": true, "alwaysEnabled": false, "type": "checkbox", "input": true, "key": "one" }, { "label": "two", "shortcut": "", "mask": false, "disabled": true, "tableView": true, "alwaysEnabled": false, "type": "checkbox", "input": true, "key": "two", "logic": [ { "name": "enableLogic", "trigger": { "type": "simple", "simple": { "show": true, "when": "one", "eq": "true" } }, "actions": [ { "name": "enableAction", "type": "property", "property": { "label": "Disabled", "value": "disabled", "type": "boolean" }, "state": "false" } ] } ], "conditional": { "show": "", "when": "", "json": "" }, "customConditional": "" } ], "settings": { "pdf": { "id": "1ec0f8ee-6685-5d98-a847-26f67b67d6f0", "src": "https://files.form.io/pdf/5692b91fd1028f01000407e3/file/1ec0f8ee-6685-5d98-a847-26f67b67d6f0" } } }

ranjanasisodia avatar Jan 28 '19 11:01 ranjanasisodia

@travist @randallknutson Any update?

ranjanasisodia avatar Feb 04 '19 12:02 ranjanasisodia

No update. We added this to our planning, but is not prioritized. If this is urgent, then you can pay to expedite the resolution of this issue. Let us know if you want to go that route, but in the meantime, the only answer I have is we will get to it when we are done with other higher priority items.

It should also be noted, that the logic feature is open source if you would like to investigate the errors on your own.

travist avatar Feb 04 '19 15:02 travist

@travist @randallknutson Is there any update on this?

rishabh47 avatar Aug 01 '19 06:08 rishabh47

This item is currently on one of our developers list. As Travis mentioned earlier, we do have an option to expedite this issue. Please contact [email protected].

Thanks.

wag110894 avatar Aug 01 '19 20:08 wag110894

Maybe this issue has been fixed already? Based on the JSON in https://github.com/formio/formio.js/issues/822#issuecomment-458096815, I have created https://jsfiddle.net/franke_mc/963nf54y/7/ , which looks ok to me. Am I missing something?

franke-mc avatar Nov 25 '19 17:11 franke-mc