The “show quoted messages” link breaks other controls

In Sharepoint discussion boards, there is the “show quoted messages” button within each post. It allows to collapse/expand the quoted message.

However this button causes a serious problem:
If you place additional postback sensitive controls on the discussion page, they might break whenever the “show quoted messages” is clicked. This happens, because this button does not perform a valid postback.

Here is a JS based fix:

// workaround for broken show-quoted-text button in discussion board
// see core.js for the original function

function ShowQuotedText(guid, anchor) {
    var frm = document.forms[MSOWebPartPageFormName];
    frm.CAML_ShowOriginalEmailBody.value = frm.CAML_ShowOriginalEmailBody.value.concat(guid);
    if (frm.action.indexOf("#") > 0) {
        frm.action = frm.action.substr(0, frm.action.indexOf("#"));
    frm.action = frm.action.concat("#" + anchor);
    // a raw form submit will cause the people editor to break
    // perform a proper postback instead
    __doPostBack('__Page', ''); 
    return false;

Simply include this snipped in the header of the affected page, or in an external JS file. Just make sure that it is being loaded after core.js.


1 Response to “The “show quoted messages” link breaks other controls”

  1. 1 bed elevators 2 inch Trackback on March 24, 2018 at 9:38 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: