Steps to reproduce: - Copy an existing rule - Don't change anything and click "Add" - Message "This rule already exists." is shown Result: The value for "Rule position" was lost. If the user wanted to duplicate a rule next to the original rule, for whatever reason forgot to change anything, clicked Add, then corrected the rule and saved, it would have been created at an unexpected position. Quite hypothetical, I know =)
When a new or copied rule was shown again after an error (e.g. "This rule already exists."), the field for its position was always emptied. It keeps the submitted position now, see "firewall.cgi: Keep the rule position of a new rule after an error". When an existing rule is edited and saving fails, the editor still reloads the saved rule, so all changes are lost and not only the position. That needs a bigger change and is not part of this. How to test once this is in a core update: 1. Copy a rule and set a position. 2. Press Add without changing anything. 3. After the error, the field still shows that position. The fix is on the branch webui-escaping, which cleans up the whole web user interface and has not been merged yet. It will ship with a core update that has not been decided yet: https://git.ipfire.org/?p=people/ms/ipfire-2.x.git;a=shortlog;h=refs/heads/webui-escaping