The post will still be saved even when remote validation failed

Support General The post will still be saved even when remote validation failed

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #36498
    Yi TongYi Tong
    Participant

    When I update a post, the field validation failed and the error message displayed, however the post is still saved to the database.
    Only after this first submission, if not refrenshing the page, the validation will correctly prevent the submission.
    I need to maintain a meta which is unique to each post so I write a remote validation to report duplication. But the duplicated value is saved anyway no matter valid or not, everything is messed up.

    #36508
    Long NguyenLong Nguyen
    Moderator

    Hi Yi,

    Are you using the Block editor? The remote validation only works with the Classic editor, refer to this topic https://support.metabox.io/topic/remote-validation-example/#post-22957

    #36519
    Yi TongYi Tong
    Participant

    So there is no way to write custom validation for the block editor? I can't believe this problem still exists after two years...
    Currently I add a filter to 'update_post_metadata' hook to run the validation also in here to prevent writing invalid meta into database, combining with the notification of the remote validation, to produce my expected behavior in some extent.
    Maybe the Meta Box team can also do some trick like this to support block editor natively?

    #36535
    Long NguyenLong Nguyen
    Moderator

    Hi,

    It is very complicated to make the remote validation works with the Block editor. Our development team has tried to resolve this issue but no luck. I will inform them to take a look again and see if they can do something in the future updates.

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