question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Select with default on change

See original GitHub issue

I am trying to configure a select box with specific values and a default value based on another select box value selected. My present configuration is as below but I cannot select another option then the default one. Please advise the correct way.

{ "display": "form", "settings": { "pdf": { "id": "1ec0f8ee-6685-5d98-a847-26f67b67d6f0", "src": "https://files.form.io/pdf/5692b91fd1028f01000407e3/file/1ec0f8ee-6685-5d98-a847-26f67b67d6f0" } }, "components": [ { "label": "Type", "widget": "choicesjs", "tableView": true, "data": { "values": [ { "label": "Storing", "value": "Storing" }, { "label": "Vraag", "value": "Vraag" } ] }, "selectThreshold": 0.3, "validate": { "unique": false, "multiple": false }, "key": "Type", "type": "select", "indexeddb": { "filter": {} }, "input": true }, { "label": "Priority", "widget": "choicesjs", "tableView": true, "dataSrc": "custom", "data": { "values": [ {} ], "custom": "thisValues = [];\r\nif(data.Type == \"Storing\" || data.Type == \"Schade\")thisValues = [{\"label\":\"Prioriteit 1\",\"value\":\"Urgent\"}];\r\nif(data.Type == \"Vraag\" || data.Type == \"Onderhoud\" || data.Type == \"Update\")thisValues = [{\"label\":\"Prioriteit 3\",\"value\":\"Niet urgent\"}];\r\nvalues = thisValues;" }, "searchEnabled": false, "selectThreshold": 0.3, "allowCalculateOverride": true, "validate": { "unique": false, "multiple": false }, "key": "Priority", "logic": [ { "name": "SetValue Storing", "trigger": { "type": "simple", "simple": { "show": true, "when": "Type", "eq": "Storing" } }, "actions": [ { "name": "SetValue", "type": "value", "value": "value = 'Prioriteit 2';" } ] }, { "name": "SetValue Vraag", "trigger": { "type": "simple", "simple": { "show": true, "when": "Type", "eq": "Vraag" } }, "actions": [ { "name": "SetValue", "type": "value", "value": "value = 'Niet urgent'" } ] } ], "type": "select", "indexeddb": { "filter": {} }, "input": true }, { "type": "button", "label": "Submit", "key": "submit", "disableOnInvalid": true, "input": true, "tableView": false, "validate": { "unique": false, "multiple": false } } ] }

Kind regards, Mario

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
randallknutsoncommented, Feb 11, 2020

There should be another option for “Clear Value On Refresh Options” that will clear the selected item when the options change.

0reactions
ahka01commented, Nov 12, 2020

Hello @KyooMario,

Would please elaborate more how you were able to change the selection of Select depending on other value during runtime?

Hello Randall,

OK. I understand. So my present state is that after the form load when I make a selection in Select box A the Select box B is showing the correct values and default value. But when I make a selection in Select box B this value is “locked in” meaning that when I change the selection in Select box A the earlier selected value in Select box B shows as the default value even if this value is not (even) part of the values (options).

So how would I remove the selected value in Select box B after a change in Select box A.

Kind regards, Maro

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I set the default value for an HTML <select> element?
I just posted an answer that enables to dynamically change the defaults, it also covers the multiple selection. And it works in Reactjs....
Read more >
How to set the default value for an HTML <select> element
The default value of the select element can be set by using the 'selected' ... < p >The Starter option will be selected...
Read more >
How to set the default value for an HTML ... - Educative.io
You can choose your default value by setting your default value of choice to selected , as shown below.
Read more >
Change default programs in Windows - Microsoft Support
Select Start > Settings > Apps > Default apps. To change the default app, you can do either of the following: Set a...
Read more >
Default select option - Material Design for Bootstrap
Hi. I want to use the value of a select dropdown as a filter for a table. Using the snippet linked the select...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found