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.

[feature request] Share variables between inputs in input_group

See original GitHub issue

Is it possible to define one of the inputs based on another input when we have multiple inputs in input_group? This requires some way of passing the output of an input in the input_group to the next input. An application of this is when we have two drop down menus for example and the options of the second drop down menu change based on what the user chooses from the first drop down menu. Something like this example:

DBs = ['DB1', 'DB2', 'DB3']
Tables = ['Table1', 'Table2', 'Table3', 'Table4']
text_info = input_group('Database and table name', [
                      select(label='Select the database of the table:', options=DBs, name='DB_name'),
                      select(label='Select the name of the table:', options=Tables, name='Table_name')
                      ])

So is there a way to bind the options of the second drop down menu above to the user selection from the first drop down? Like if the user chooses ‘DB1’ then the options in the second menu will be ‘Table1’ and ‘Table2’ but if the user chooses ‘DB2’ the options will be ‘Table3’ and ‘Table4’.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
wang0618commented, Jun 19, 2021

Now you can use the input_update() with the onchange callback to make dependent input.

Doc: https://pywebio.readthedocs.io/en/latest/input.html#pywebio.input.input_update Demo: http://pywebio-demos.demo.wangweimin.site/doc_demo?app=demo-input-update

1reaction
wang0618commented, Apr 19, 2021

PyWebIO does not support this feature currently. I will add it in todo list.

Here is a workaround for now:

DBs = ['DB1', 'DB2']
Tables = {'DB1': ['Table1', 'Table2', ], 'DB2': ['Table3', 'Table4']}
db_name = select(label='Select the database of the table:', options=DBs)
table_name = select(label='Select the name of the table:', options=Tables[db_name])
put_text(table_name)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Laravel get request pass input data - php - Stack Overflow
I think I am trying to access the variable incorrectly, previously when using ->with() with View::make() I was able to access the variables...
Read more >
Input group · Bootstrap v5.0
Easily extend form controls by adding text, buttons, or button groups on either side of textual inputs, custom selects, and custom file inputs....
Read more >
User's guide — PyWebIO 1.7.0 documentation - Read the Docs
This user guide introduces you the most of the features of PyWebIO. ... PyWebIO's input functions is blocking (same as Python's built-in input()...
Read more >
Global input variables between tasks.json and launch.json
Hello, I saw that issue #43782 is closed as by design. However it would be nice to have variables that can be carried...
Read more >
Input - dbc docs - Dash Bootstrap Components - Faculty AI
They have been designed to share the same interface as the corresponding components in dash-core-components for familiarity, but have a few additional Bootstrap ......
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