[Question] how validate only numbers or letters in TextField ?? #2031
-
Questiontengo dos textbox codpro and nompro. I have two Textbox CodPro and NomPro. codpro is the code of the product and I would like it to only allow numbers I was reviewing the documentation of Flet and I saw that it could Keyboard_type work but it provides and it did not work. I would like to do the same for nompro that only allows me texts Lo mismo quisiera hacer para nompro que solo me permita textos Alguna sugerencia como lo podría hacer ?? Any suggestions how I could do it?? Code sampledef main(page):
#Tamaño de ventana
page.window_resizable = False
#CONTROLES (Controls)
codpro = TextField(label="CÓDIGO PRODUCTO", width = 200, keyboard_type = KeyboardType.NUMBER)
nompro = TextField(label="NOMBRE PRODUCTO", width = 600)
#combo de categoria (Category)
ddcate = Dropdown(label="CATEGORIA",
width=150,
options=[
dropdown.Option("dulce"),
dropdown.Option("salado"),
],
)
#combo de peso (weight)
ddpeso = Dropdown(label="PESO",
width=100,
options=[
dropdown.Option("KG"),
ft.dropdown.Option("G"),
],
)
#Boton AGREGAR
BtnAgregar = ElevatedButton(
text="Agregar",
bgcolor="green",
color="white",
on_click=agregar
)
page.add(
Column([
Text("PRODUCTOS",size=30,weight="bold"),
codpro, nompro,ddcate, ddpeso,
Row([BtnAgregar]),
tablaproducto
])
)
ft.app(target=main) Error messageNo response ------------------------------------------------------
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Thats not directly possible at the moment. You can use the |
Beta Was this translation helpful? Give feedback.
Thats not directly possible at the moment. You can use the
on_change
event to indirectly do this. (although its not that beautiful tbh)Here is an opened issue for that: #631
@FeodorFitsner, did you perhaps see my comment in that issue? (#631 (comment))