Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make cascading updates to SelectBox in a Modal form? #65

Open
jwag59 opened this issue Jul 4, 2022 · 0 comments
Open

How to make cascading updates to SelectBox in a Modal form? #65

jwag59 opened this issue Jul 4, 2022 · 0 comments

Comments

@jwag59
Copy link

jwag59 commented Jul 4, 2022

I have a modal form with three SelectBox elements. See screenshot below.
I want to be able to change the content of the 2nd SelectBox (i.e. the 'data' option) based on the user selection from the first. And similarly for the 3rd SelectBox based on what the user selects in the 2nd box.

My current method (which does not work) is as folows:

Modal definition:

   return ShowModalForm('New Repo', [
       SelectBox('Distro', id='distroselect', data=Config.cfg_int['repos']['supported_repos'], placeholder="Select One", on_change=distro_selected, required_message='You must select a Distribution for the new Repo'),
       SelectBox('Version', id='versionselect', data=[], placeholder="Select One", required_message='You must select a version of the repo'),
       SelectBox('Architecture', id='archselect', data=[], placeholder="Select One", required_message='You must select an architecture for the Repo'),
       Upload(title='Upload a new ISO or Repo tar file', name='repo_upload', on_data=on_repoupload),

And the on_change=distro_selected function returns:

return [UpdateElement('versionselect', data=Config.cfg_int[data.lower()]['supported_versions'])]

But the Version id SelectBox always shows No Data!!

Any hints on how to do this?

modal_cascading_data_updates_of_selectbox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant