• I’m developing a knowledgebase plugin that creates a custom post type with an answer field. I’d like to warn the user when they’re about to publish a KB article without filling out an answer, and my assumption is that the best way to do this is through a javascript confirmation dialog. What’s the best way to attach the confirmation box as an ‘onsubmit’ trigger on the Publish button? I’d like to stick to the standard WordPress plugin protocol here.

    I think the best way for me to do this is to use the admin_body_class filter to attach an onLoad() event, which in turn uses getElementById to attach my confirmation dialog to the id=”original-publish” button. This seems kludge-ey, though. Is there a better way to do this?

    Let me know if I can offer clarification on exactly what I’m trying to do, or if I’m completely off base.

  • The topic ‘Attach confirmation dialog to publish button’ is closed to new replies.