We’ve seen the following behavior in one of our content types:
[li]Add a field validation to a field.
[/li][li]Enter an item, with data that causes successful validation.
[/li][li]Save the item.
[/li][li]Edit the item again, entering data that causes validation failure.
[/li][li]When the validation failure message is displayed, the new field value has been replaced by the one previously saved for that item - i.e. the data just entered has disappeared, and been replaced by the last saved field value.
Is this normal/expected behavior for field validation?
We had this same issue and tech support say it is expected behaviour. I tend to disagree.
Thanks for the reply on this, Keevan.
It may be “expected behavior” for Rhythmyx (I will certainly expect it going forward), but that doesn’t make it correct or standard behavior.
In my experience, most data entry systems don’t erase the offending data when validation fails. Ideally, the system should provide information in the validation failure message to allow the user to correct - but leave the offending data there, to maintain continuity for the user. If the user wants to back out of the data entry change completely, and get the previous value back, they can always cancel out of the editor window without saving.
Here is a fix for the cleared checkbox field on validation failure. In sys_templates.xsl clone the SingleCheckBox control (since sys_templates gets overwritten with patches/upgrades) and copy it to rx_templates.xsl and then change this
xsl:if test="Value = $ISselected"
xsl:if test="@selected = 'yes'"