Skip to content

Commit

Permalink
[#4774] Added normalizer method to the the Textfield component
Browse files Browse the repository at this point in the history
  • Loading branch information
vaszig committed Oct 21, 2024
1 parent d191472 commit b0917f3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/openforms/formio/components/vanilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ class Default(BasePlugin):
class TextField(BasePlugin[TextFieldComponent]):
formatter = TextFieldFormatter

@staticmethod
def normalizer(component: Component, value: str) -> str:
if isinstance(value, (int, float)):
return str(value)
return value

def build_serializer_field(
self, component: TextFieldComponent
) -> serializers.CharField | serializers.ListField:
Expand Down

0 comments on commit b0917f3

Please sign in to comment.