St.form_submit_button to update Postgres database

Started using Streamlit last week, instant fan. The app I’ve developed is very simple. I am collaborating with a group of scientists (app users) and need to have a simple platform for them to perform quality assessment (QA) review on some data. I use st.form that has some select boxes that lets users select a measurement from the project database for review. Once these options are selected, I have a st.form_submit_button that triggers the app to go get the data from the database based on the user input. It then writes out the data and makes a couple charts for them to look at, and then 2 drop down menus and a text box are provided to allow them to provide their input. A second st.form_submit_button is used to commit their input to the database.

Here’s the issue. This works perfectly in local development using an SQLite database. I updated the app to point to a Postgres database rather than my local test SQLite database. Everything still works perfectly except the second st.form_submit_button. It behaves totally differently now and does not commit anything to the database. Just to check, I put the database commit before the submit button and it commits, but only commits blanks (as if no input). For example, when put before the second submit button this successfully commits blank text ("") to the Postgres database even when there is user input:

CUR.execute("UPDATE table SET euid = ‘userinput1’ WHERE hashid = ‘userinput2’)

While this does not commit anything to the Postgres database, clears the form (with clear_on_submit = False), and starts over without doing anything or raising any errors:

commitbutton = st.form_submit_button(label = ‘Click here to commit changes to database’)
if commitbutton:
CUR.execute("UPDATE table SET euid = ‘userinput1’ WHERE hashid = ‘userinput2’)

Only the second st.form_submit_button is in question here. I haven’t changed anything else about the app except the database that it points to.

Have you had any luck figuring this out as I have exactly the same issue.

I have the following form code and writing to a SQLite db:

def FaddCase():

with st.form(key = "addData"):

    FcaseName = st.text_input ("Case Ref...")

    Fcris = st.text_input ("CRIS Number...")

    FclientName = st.text_input ("Client Name...")

    Ftrt = st.text_input ("TRT...")

    FagreedHours = st.number_input ("Agreed Hours...")

    FactualHours = st.number_input ("Actual Hours...")

    FcostCode = st.text_input ("Cost Code...")

    FoffType = st.text_input ("Offence Type...")

    Fstatus = st.text_input ("Status...")

    Foic = st.text_input ("OIC...")

    _returnedData = [FcaseName, Fcris, FclientName, Ftrt, FagreedHours, FactualHours, FcostCode, FoffType, Fstatus, Foic]

    curs.execute("INSERT INTO Tcases VALUES (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", _returnedData)


    _submitForm = st.form_submit_button("Commit to Database")

It merely puts in a blank record to the db :frowning:
Any help/update would be appreciated.