[wp-trac] Re: [WordPress Trac] #9372: "Preview" button in edit page
button does not work.
WordPress Trac
wp-trac at lists.automattic.com
Mon Mar 23 17:03:31 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
----------------------------+-----------------------------------------------
Comment(by webstoc):
I see. Well, I don't use firebug that much; in the past when I tried it,
I had the same cache problem with it as the fellow who filed
[http://code.google.com/p/fbug/issues/detail?id=207 this] bug report.
Maddening. So, I gave it a try per your suggestion, but I may not be using
it correctly.
I did a minor rewrite of the function, like so:
{{{
$('#post-preview').click(function(e){
//convenience function
function _d(msg){
dump(msg + "\n");
};
if ( 1 > $('#post_ID').val() && autosaveFirst ) {
autosaveDelayPreview = true;
autosave();
return false;
}
var myform = $('form#post');
_d("target: " + myform[0].target);
myform.attr('target', 'wp-preview');
_d("target: " + myform[0].target);
_d("submit: " + myform.submit);
//bind submit function
myform.submit(function(){
_d('form submitted.');
});
myform.submit();
myform.attr('target', '');
return false;
/*
$('input#wp-preview').val('dopreview');
$('form#post').attr('target', 'wp-
preview').submit().attr('target', '');
$('input#wp-preview').val('');
return false;
*/
});
}}}
The output of which in the console looks like so:
{{{
target:
target: wp-preview
submit: function (a) {
return a ? this.bind(b, a) : this.trigger(b);
}
form submitted.
}}}
So, the post-submit action of the form *is* being triggered. In the
firebug console however, I noted *no* action on the "Net" tab (subsequent
to button press), implying the post is likely not actually happening, as
you suggested. A false return, perhaps? That would account for the
behavior.
Ducking into edit-form-advanced.php, the target form is found (for me) on
line 520. Adding an onsubmit event here:
{{{
<form name="post" action="post.php" method="post" id="post"
onsubmit='dump("foo\n");'>
}}}
Gives this:
{{{
target:
target: wp-preview
submit: function (a) {
return a ? this.bind(b, a) : this.trigger(b);
}
form submitted.
foo
}}}
I see no inline binding of submit events here, and none in post.js. Is
there another location that might return false?
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9372#comment:3>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list