@gvallverdu wrote:
Hello
I try to use a regex pattern to check the contains of an Input field. I want to check if the string is a True Hex color (to save space I would like to avoid the color picker from DAQ). To do so, I filled the
pattern
attribute of the Input such as:#!/usr/bin/env python3 # -*- coding=utf-8 -*- import dash import dash_html_components as html import dash_core_components as dcc from dash.dependencies import Input, Output app = dash.Dash(__name__) app.layout = html.Div(children=[ dcc.Input( id="color-value", debounce=True, placeholder="#000000", type="text", pattern=u"^#([A-Fa-f0-9]{6}$" ), html.Div(html.P(id="text")) ]) @app.callback( Output("text", "children"), [Input("color-value", "value"), Input("color-value", "pattern")] ) def write_text(value, pattern): print(pattern) return value if __name__ == "__main__": app.run_server(debug=True)
But whatever I write in the input, a True or a wrong color Hex code, I got the same result and nothing change.
Thanks for your help
dash==1.7.0 dash-core-components==1.6.0 dash-html-components==1.0.2 dash-renderer==1.2.2
Posts: 7
Participants: 2