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.

Still problem with validation and Dynamic filled dropdowns

See original GitHub issue

The issue I opened is closed, https://github.com/google/blockly/issues/2926 , so I open a new one. Hi, we tested with the last Blockly, 3.20191014.4, and we still have the problem with dynamic filled dropdowns.

An example to reproduce the problem with dynamic filled dropdown (in function of another dropdown value)

blockly_dyn_fields.zip (I used last blockly from today)

By doing this: using a function to fill FieldDropdown (with generateOptions a function)

this.appendDummyInput()
        .appendField(new Blockly.FieldDropdown(generateOptions), "FIELD_NAME");

then this error occurs:

Cannot set the dropdown's value to an unavailable option. Block type: test_dyn_field_field_block_type, Field name: FIELD_NAME, Value: SET2_FIELD3
Blockly.FieldDropdown.doClassValidation_ @ field_dropdown.js:420
Blockly.Field.setValue @ field.js:726
Blockly.Field.fromXml @ field.js:353
Blockly.Xml.domToField_ @ xml.js:802
Blockly.Xml.domToBlockHeadless_ @ xml.js:695
Blockly.Xml.domToBlockHeadless_ @ xml.js:733
Blockly.Xml.domToBlockHeadless_ @ xml.js:709
Blockly.Xml.domToBlock @ xml.js:544
Blockly.Xml.domToWorkspace @ xml.js:415
(anonymous) @ index.html:33

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
BeksOmegacommented, Dec 4, 2021

Am I correct about this being the issue that didn’t work before?

I believe so yes. I think this was fixed when an explicit deserialization order was added. This change made it so that blocks are connected to their parents (but not children) before fields are deserialized. So now dynamic dropdowns can properly access the parent during deserialization.

Before, xml nodes were just processed in the order they appeared. Which mean fields were usually processed before blocks were connected to their parents. See the previous version.

1reaction
samelhusseinicommented, Mar 9, 2020

It’s unclear to me what the next steps are here. The problem is as follows: The user selects a dropdown option that is valid at the time, and so the FieldDropdown saves that value, which is then serialized to XML and saved as the field value. Later, when the XML is imported into Blockly, that option is no longer valid which doesn’t allow the value to be set, and outputs a warning.

We don’t provide a way to turn off that validation option (as it’s a class validator). @BeksOmega if you have some ideas.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Excel Data Validation Tips and Troubleshooting - Contextures
This page has data validation tips, and shows how to fix Excel data validation problems, such as drop down not working, blank selected, ......
Read more >
Create a dynamic dependent drop down list in Excel an easy ...
When I drag the data validation down and I go to the dropdown in next row down it still references first row selection....
Read more >
How to create dynamic data validation and extend the drop ...
Normally, when you create a drop down list in a worksheet, the drop down list will not be changed with the new data...
Read more >
How to Add New Rows to Drop-down Lists Automatically
Learn how to create dynamic data validation lists. ... The drop-down button will still appear next to the cell, but you won't be...
Read more >
How to create simple or dynamic drop-down validation lists in ...
You may have experienced this when filling forms on the Internet for instance. Typing text is way longer that if you just have...
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