Custom “Publish” / “Update” button &

Question

I’m trying to implement a “publish” button from a custom post type metabox. Everything actually works fine if I either create a new button and manually call submit() or duplicate the regular submit buttons, except for one thing: if i change the title of the post, I always get the “Confirm Navigation” popup asking me if I want tstay or leave the page. It doesn’t do this when using the regular “Update” button though, so there’s gotta be a way to stop it, I just can’t seem to get a handle on it.

Custom save button using a link:

<a href="#" id="saveChangesButton" class="button-primary alignright">Save</a>

// in ready()
$('#saveChangesButton').live('click', function() {
        $('#saveChangesButton').addClass('button-primary-disabled');
        $('#post').submit();
        return false;           
});

Custom save buttons trying to mimic the submitdiv’s buttons:

<?php if ($_GET['action'] == 'edit') : ?>
    <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Save') ?>" />
    <input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="Update">

<?php else: ?>
    <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" />

    <input name="publish" type="submit" id="publish" class="button-primary" value="Publish" tabindex="5" accesskey="p">
<?php endif; ?>
0
flashape 8 months 2020-11-27T05:10:37-05:00 0 Answers 13 views 0

Leave an answer

Browse
Browse