Catching Form Submission in WordPress Admin Panel

You can store field values and error messages in session or transient and use them when (re)displaying your form.

In your callback action, if data is not valid, save error message and submitted field values. In admin_notices hook check for saved error message. If there is one, show it as error notice. Don’t forget to remove saved session/transient value.

In form builder code check session/transient for saved field values, if there are such, use them in value="..." or as needed.

This might help.

error code: 523