I’m trying to create a form with multiple kinds of inputs. I would like to save these inputs into a Pandas Dataframe and eventually write it into a PostgreSQL database on clicking the Submit Button. I would also like to re-route to a new page containing an editable dash table containing values read from another PostgreSQL table.
I’m new to Dash but I’m working on a great project. Would appreciate any help!
Thanks!
1 Like
Work around:
html.A(html.Button(‘Submit!’, id=‘submit’),
href=’/apps/app2’),
1 Like
Also, I would like to know how to implement the Clear Form functionality where all the inputs are refreshed to defaults on button press.
You can do a regular form with dash html components, then add a route to the flask server to handle the form submission.
Basic example:
import flask
import dash
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash(__name__)
app.layout = html.Form([
dcc.Input(name='name'),
html.Button('Submit', type='submit')
], action='/post', method='post')
@app.server.route('/post', methods=['POST'])
def on_post():
data = flask.request.form
print(data)
return flask.redirect('/')
if __name__ == '__main__':
app.run_server(debug=True, port=7779)
1 Like
You can clear form with a html.Button('clear', type='clear')
.
1 Like
HI Philippe.
I am trying to run strikethrough application inside flask application.
I want to save the selected parameters.
Eg:
my web link: http://172.16.10.234:8000/Sumary_Report/
after i select the time, it is: http://10.38.3.191:8000/Sumary_Report/?select_time=08092021
I just tried your example and changed it to GET but it didn’t work as expected.
Please help me …