custom block with file input and dependent field dropdown

62 views
Skip to first unread message

michele.0...@gmail.com

unread,
Jul 25, 2023, 4:44:27 AM7/25/23
to Blockly
Hi,
I'm trying to create a new block with a custom input that accepts a text file and then two dropdowns that change depending on the file.

immagine_2023-07-25_103328239.png

I tried to create a new block like this, the checkbox will need to be changed to become a load file button or a drop zone.

Many options must be added in each of the two dropdowns by reading the text file (.ldf format) 

I hope you can help me.

Thank you,
Michele


Maribeth Moffatt

unread,
Jul 25, 2023, 2:42:29 PM7/25/23
to Blockly
Hello Michele,

The Block Factory can help you create simple blocks, but for more complicated blocks like the one you're describing, you'll need to hand-craft the block definition. Start with the documentation on block definitions. We don't provide a field that handles file upload, so you'll also need to create a custom field. And while we do support dynamic dropdown options, creating dropdown fields that are dependent on each other is a bit tricky and has a lot of edge cases to consider. You might want to check out the dependent-dropdown plugin we provide, either to use as-is or just to learn about the kind of edge cases you need to consider in this kind of block design.

If you have more specific questions after reading the docs and starting your implementation, please let us know! Good luck,

Maribeth

Reply all
Reply to author
Forward
0 new messages