[wp-trac] [WordPress Trac] #9372: "Preview" button in edit page
button does not work.
WordPress Trac
wp-trac at lists.automattic.com
Fri Mar 20 15:59:52 GMT 2009
#9372: "Preview" button in edit page button does not work.
----------------------------+-----------------------------------------------
Reporter: webstoc | Owner: anonymous
Type: defect (bug) | Status: new
Priority: normal | Milestone: Unassigned
Component: Administration | Version: 2.7.1
Severity: normal | Keywords: edit, preview, post
----------------------------+-----------------------------------------------
I'm running multiple instances of wordpress for a group of customers in a
variety of blogs, and they all have been reporting for awhile that the
preview button in the edit post section of their blog is broken. I
finally took time to chase down the section of the code that's responsible
for this.
In wp-admin/js/post.js (line 385 for my version - 2.7.1), there exists the
following code block:
$('#post-preview').click(function(e){
if ( 1 > $('#post_ID').val() && autosaveFirst ) {
autosaveDelayPreview = true;
autosave();
return false;
}
$('input#wp-preview').val('dopreview');
$('form#post').attr('target', 'wp-
preview').submit().attr('target', '');
$('input#wp-preview').val('');
return false;
});
This jquery code retrieves a hidden field in the form generated by edit-
form-advanced.php, populates it, submits the form, and clears the value.
It then returns false, which is of course why the button is not working
for my users. The question is, why is the form submission not working?
The ff error console is unenlightening, but that's not surprising; I've
found jQuery does have a tendency to suppress errors.
I've checked what's being returned by the various jquery selectors in that
instance, and everything seems on the up and up. I do note that
commenting out that block, including the false return value, yields a
preview page in a separate tab that works just fine. E.g.:
$('#post-preview').click(function(e){
if ( 1 > $('#post_ID').val() && autosaveFirst ) {
autosaveDelayPreview = true;
autosave();
return false;
}
/*
$('input#wp-preview').val('dopreview');
$('form#post').attr('target', 'wp-
preview').submit().attr('target', '');
$('input#wp-preview').val('');
return false;
*/
});
Not knowing why this is being done by form rather than by just hyperlink,
coupled with the fact that I'd be off the reservation when it came to
updates, makes me loathe to make this sort of fix for my users. I didn't
see any instance of this particular problem in the trac so far. Can
advise?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/9372>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list