So, I'm trying to create this form using dash. I want to read all the inputs from this form and throw it into a dataframe. I was able to reference a single input using the callback but I'm unable to reference multiple inputs to be returned using the callback. I'm very new to this.
What am I doing wrong here?
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
from dash.exceptions import PreventUpdate
app.config.external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
# build your Dash app
app.layout = html.Div(
[
html.H2('Form'),
html.B("Reciever's Name:"),
html.Br(),
dcc.Input(id='input-1-state', type='text', placeholder='Enter Name', style={'color':'blue','font-family':'verdana'}),
html.Br(),
html.Br(),
html.B("Reciever's Email:"),
html.Br(),
dcc.Input(id='input-2-state', type='email', placeholder='Enter email', style={'color':'blue','font-family':'verdana'}),
html.Br(),
html.Br(),
html.B("Sender's Name:"),
html.Br(),
dcc.Input(id='input-3-state', type='text', placeholder='Enter name', style={'color':'red','font-family':'verdana'}),
html.Br(),
html.Br(),
html.B("Sender's Email:"),
html.Br(),
dcc.Input(id='input-4-state', type='email', placeholder='Enter email', style={'color':'red','font-family':'verdana'}),
html.Br(),
html.Br(),
html.B("Date:"),
html.Br(),
dcc.Input(id='input-5-state', type='date', placeholder='', style={'color':'red','font-family':'verdana'}),
html.Br(),
html.Br(),
html.B("Location:"),
dcc.Dropdown(['NYC', 'MTL', 'SF'], searchable=True, id='dropdown'),
html.Br(),
html.Br(),
html.B("Select list of values she/he/they demonstrated"),
html.Br(),
html.Br(),
dcc.Checklist(options=[
{'label': 'New York City', 'value': 'NYC'},
{'label': 'Montreal', 'value': 'MTL'},
{'label': 'San Francisco', 'value': 'SF'}]),
html.Br(),
html.B("Tell us a little about xyz:"),
html.Br(),
dcc.Input(id='input-6-state', type='text', placeholder='Built a very useful dashboard for the sales team', style={'color':'blue','font-family':'verdana','width':'100%', 'height':'flex'}),
html.Br(),
html.Br(),
html.Button(id='submit-val', n_clicks=0, children='Submit'),
html.Br(),
html.Br(),
html.Div(id='output-container-button',children='Enter a value and press submit')
])
@app.callback(
dash.dependencies.Output('output-container-button','children'),
[dash.dependencies.Input('input-1-state','value'),
dash.dependencies.Input('input-2-state','value')]
)
def update_output(value1,value2):
return "Reciever's Name: {} and Reciveers email: {}".format(value,value)
