-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Checklist
- I have searched the existing issues for similar feature requests.
- I added a descriptive title and summary to this issue.
Summary
When using a selectbox, we sometimes want to display additional information to the user (e.g., a description) via format_func. With the current query parameter binding implementation, the value written to the URL query parameter is always the result of format_func. This means that any descriptive text shown to the user also ends up in the query parameter, which is not always desirable.
Why?
I would like to keep clean query parameters in the URL, such as:
?station_id=3443
while still displaying richer information in the selectbox, such as station_label and station_elevation.
How?
Possible solutions:
Use the widget return value instead of the result of format_func when writing the query parameter. However, this would only work for simple types.
(Preferred) Introduce an option such as query_param_func, allowing developers to define how the query parameter value is derived. For example, it could extract the id from an object to use as the query parameter value.
Additional Context
No response