Callback is not called

#1

Hi I have question and look for solution or alternative something

There are action scenario

  1. leave some information on lnitial layout

  2. write some information on input box

  3. call callback function through information on initial layout with write new information

my code is below.

layout = html.Div([
        	html.Div(id='tail_url', children="url_info", style={'display': 'none'}),
	
		dcc.Input(
                     id='subscribe_content',
                     placeholder="Enter",
                     type='text'
                 ),
		dcc.ConfirmDialogProvider(
                         html.Button(
                             id='subscribe_button',
                             children='subscribe'
                         )
                     )
	    ])


@app.callback(
    Output('subscribe_button', 'message'),
    [Input('tail_url', 'children')],
    [State('subscribe_content', 'value')],
    )
def register_member(mypath, input_data):

    if input_data is None:
        print("data is none")
        return None

    page_param = mypath.split('/')
    page_param = page_param[len(page_param) - 1]

    chk_id = find_memlst.memlst_writer(page_param, input_data)

    if chk_id.Isexist():
        return "already applied!"

    return "not applied"

My intention is when I write some data in input box, Callback function would be call

However nothing happened.

last one, Tell about id(tail_url). I tried Input component with ‘url’, ‘pathname’. It`s also not works

please give me a hand. Thanks, in advance.

#2

Hi, dash callbacks are called only on input changes, not state changes. So your callback as it is would fire only on tail_url div children change that never happens. You probably want to change url to state and subscribe to input (and change the order)

2 Likes