You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't set empty string for Search Bar.value in WEB mode.
In normal mode, it works fine. Tested in Chrome, Opera and Edge.
I am running the following code using the following command: flet run --web main.py
Code sample
importfletasftdefmain(page):
defclose_anchor(e):
text=f"Item {e.control.data}"print(f"closing view from {text}")
anchor.close_view(text)
defhandle_tap(e):
e.control.open_view()
defclean_function(e):
anchor.value=""#This doesn't work.# anchor.value = " " # This works and updates visually.# anchor.value = "Some text" # And this as well.anchor.update()
anchor=ft.SearchBar(
view_elevation=4,
divider_color=ft.colors.AMBER,
bar_hint_text="Test searchbar",
view_hint_text="Choose something from the suggestions...",
on_tap=handle_tap,
controls=[
ft.ListTile(title=ft.Text(f"Item {i}"), on_click=close_anchor, data=i)
foriinrange(10)
],
)
clean_button=ft.ElevatedButton(text="Clear")
page.add(
ft.Row(
alignment=ft.MainAxisAlignment.CENTER,
controls=[
ft.OutlinedButton(
"Clear searchbar textfield",
on_click=clean_function,
),
],
),
anchor,
)
ft.app(target=main)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Question
I can't set empty string for Search Bar.value in WEB mode.

In normal mode, it works fine. Tested in Chrome, Opera and Edge.
I am running the following code using the following command: flet run --web main.py
Code sample
Error message
No response
------------------------------------------------------
Beta Was this translation helpful? Give feedback.
All reactions