In form, how to in time get selectbox value? so that use the value to select

Summary

I want to use form with selectbox, if selectbox value change, then adjust other inputnumber maxvalue, but it will apearance error? how to do? remove form?

Steps to reproduce

StreamlitAPIException: With forms, callbacks can only be defined on the st.form_submit_button. Defining callbacks on other widgets inside a form is not allowed.

Code snippet:

add code here

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

Expected behavior:

Explain what you expect to happen when you run the code above.

Actual behavior:

Explain the undesired behavior or error you see when you run the code above.
If you’re seeing an error message, share the full contents of the error message here.

Debug info

  • Streamlit version: (get it with $ streamlit version)
  • Python version: (get it with $ python --version)
  • Using Conda? PipEnv? PyEnv? Pex?
  • OS version:
  • Browser version:

Requirements file

Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.

Links

  • Link to your GitHub repo:
  • Link to your deployed app:

Additional information

If needed, add any other context about the problem here.

I want to use form with selectbox

Why? The whole point of forms is hiding changes in widget values from the application until the submit button is pressed. If you want the new values to be immediately available, then you don’t want the widget to be inside a form.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.