Back End Validation Removes Unsaved Field Values

Support MB Frontend Submission Back End Validation Removes Unsaved Field Values

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #41028
    PiotrPiotr
    Participant

    When back end validation fires and fails, all the data entered into the form is gone (or original data is restored in the case of edited posts). I would expect that the form keeps all the data as entered before the form is saved even if validation fails, so that users don't have to fill everything from scratch. Apparently this is not a default behavior? If that's the case, suggestions on how to fix it would be much appreciated (keeping form data in cookies before it is saved into the database?).

    #41039
    PeterPeter
    Moderator

    Hello,

    How do you use the backend validation? Do you try to use the remote validation as I suggested before?
    https://support.metabox.io/users/user_634689848e0c8/?swcfpc=1

    Or enable ajax for the frontend submission form to prevent reloading the page. Please read more on the documentation https://docs.metabox.io/extensions/mb-frontend-submission/#submission-form

    #41052
    PiotrPiotr
    Participant

    Hi,
    To make it more precise, I am validating front end form with php, so I use rwmb_frontend_validate.

    If the validation fails, the form clears (new submissions) or restores to original post (existing submissions). As I understand, this can be overcome by using remote validation? I didn't try it yet as the other thread you recall concerned WP back end, but will check it for the front end forms so.

    #41069
    PeterPeter
    Moderator

    Hello,

    Yes, the idea is to use the JS validation to validate the field without reloading the page. If the page is reloaded, the input value will be lost if it does not pass the backend validation.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.