Skip to content

Wrong displayed value when ValidateDangerousOperationNode is empty #3

@martinburchell

Description

@martinburchell

https://github.com/RudolfCardinal/pythonlib/blob/master/cardinal_pythonlib/colander_utils.py#L495

If a ValidateDangerousOperationNode is left empty, the "required" validation for the child MandatoryStringNode fails before the parent node's validator() has a chance to be called. So the hidden target_value doesn't match the displayed value for the next form submission.

Any non-empty invalid value results in the ValidateDangerousOperationNode validator() being called and the displayed value being updated.

Example of this is on the delete user form for CamCOPS. If you leave the field empty and then enter the correct displayed value, the form fails validation.

@RudolfCardinal any thoughts on how to solve this? We can make the field non-mandatory but that doesn't seem quite right given that it is required. I see there is also something called deferred validation. I don't know if that would help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions