diff --git a/src/openforms/submissions/api/validation.py b/src/openforms/submissions/api/validation.py index 3c5775e625..5e53c64c61 100644 --- a/src/openforms/submissions/api/validation.py +++ b/src/openforms/submissions/api/validation.py @@ -57,7 +57,11 @@ def validate(self, attrs: dict): assert step.form_step components = step.form_step.form_definition.configuration["components"] - step_data_serializer = build_serializer(components, data=data) + step_data_serializer = build_serializer( + components, + data=data, + context={"submission": submission}, + ) if not step_data_serializer.is_valid(): errors = step_data_serializer.errors diff --git a/src/openforms/tests/e2e/test_input_validation.py b/src/openforms/tests/e2e/test_input_validation.py index 2f83e5f85c..2e13f708b6 100644 --- a/src/openforms/tests/e2e/test_input_validation.py +++ b/src/openforms/tests/e2e/test_input_validation.py @@ -80,6 +80,22 @@ def test_regex_house_number_addition(self): expected_ui_error="Huisnummertoevoeging mag enkel alfanumerieke karaketers zijn.", ) + def test_kvk_number_validation_plugin(self): + component: Component = { + "type": "textfield", + "key": "chamberOfCommerce", + "label": "KVK nummer", + "validate": { + "plugins": ["kvk-kvkNumber"], + }, + } + + self.assertValidationIsAligned( + component, + ui_input="aaaa", # deliberate to trigger the non-network validation + expected_ui_error="Waarde moet numeriek zijn.", + ) + class SingleEmailTests(ValidationsTestCase): def test_required_field(self):