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 ValidateDangerousOperationNodevalidator() 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.
https://github.com/RudolfCardinal/pythonlib/blob/master/cardinal_pythonlib/colander_utils.py#L495
If a
ValidateDangerousOperationNode
is left empty, the "required" validation for the childMandatoryStringNode
fails before the parent node'svalidator()
has a chance to be called. So the hiddentarget_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.