Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬Register for the Oct 27 webinar.

Dash button not working

Hi guys,
I just try Dash button. But it not working.
Please help me.
My code here.

import dash_core_components as dcc
import dash_html_components as html
import dash
from dash.dependencies import Input, Output

app = dash.Dash(__name__)

app.layout = html.Div(
    [
        dcc.Input(
            id="input",
            type="text",
            placeholder="input type {}",
        ),
        html.Div([
            html.Button('Submit', id='submit-val'),
            html.Div(id="out-all-types")
        ])
        
    ]
   
)

@app.callback(
    Output("out-all-types", "children"),
    Input("input", "value") ,
    Input('submit-val','value'),
#     prevent_initial_call=True,
)
def cb_render(vals,n_clicks):
    print(n_clicks)
    if(n_clicks!=None):
        print('val',vals)
        print('val',vals[0])
        return vals
    return 0


if __name__ == "__main__":
    app.run_server(debug=False)

Instead of
Input('submit-val','value'),
you probably want
Input('submit-val','n_clicks'),

1 Like

oh ,thank you very much.
It is work