I have the Date defined in answers.py and it works perfectly.
from dash import Dash, html
import dash_bootstrap_components as dbc
from . import ids
import datetime
def date(app: Dash) -> html.Div:
return html.Div(
[
html.H4(datetime.datetime.now().strftime('%d-%m-%Y')),
],
className="date",
id=ids.DATE
)
Then I import the code into questions.py. All Inputs besides the ids.Date works perfectly. I would assume the issue is the that in Input, template and output_string i dont know how to name the input: DATE
def render(app: Dash) -> html.Div:
@app.callback(
Output(ids.ANSWER_OUTPUT, "children"),
[
Input(ids.DATE, "date"),
Input(ids.QUESTION_1, "value"),
Input(ids.QUESTION_2, "value"),
Input(ids.QUESTION_3, "value"),
Input(ids.QUESTION_4, "value"),
],
)
def on_form_change(date, answer_1_value, answer_2_value, answer_3_value, answer_4_value):
template = 'Date: {}, Question 1: {}, Question 2: {}, Question 3: {}, Question 4: {}'
output_string = template.format(date, answer_1_value, answer_2_value, answer_3_value, answer_4_value)
return output_string