Forums

Attach confirmation dialog to publish button (1 post)

  1. cynicaloptimist
    Member
    Posted 10 months ago #

    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.

Reply

You must log in to post.

About this Topic

  • RSS feed for this topic
  • Started 10 months ago by cynicaloptimist
  • This topic is not resolved
  • WordPress version: 3.2.1