Skip to content

Commit

Permalink
extend documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
falkoschindler committed Nov 22, 2024
1 parent 9fc2fff commit 75d1c9f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions website/documentation/content/input_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ def styling():
- by passing a callable that returns an error message or `None`, or
- by passing a dictionary that maps error messages to callables that return `True` if the input is valid.
The callable validation function can also be an async coroutine.
In this case, the validation is performed asynchronously in the background.
You can use the `validate` method of the input element to trigger the validation manually.
It returns `True` if the input is valid, and an error message otherwise.
For async validation functions, the return value must be explicitly disabled by setting `return_result=False`.
''')
def validation():
ui.input('Name', validation=lambda value: 'Too short' if len(value) < 5 else None)
Expand Down

0 comments on commit 75d1c9f

Please sign in to comment.