2013-04-23, 03:36 PM
Hey everyone.
I am using this tutorial to create a modal quote post. Allow me to elaborate; when the user clicks "reply to this post" (traditionally the quote/reply button), instead of taking them to newreply.php, it opens up a modal box, where the user can reply to the post. However, I require the content of the post they are quoting to be inserted into the text box automatically.
Here is the contents of my "postbit_quote" template, where I have included the code for the modal popup:
This set up allows you to reply to the thread no problem, but I am unsure of how to get the quoted post to be inserted automatically. I have no idea what it entails or how difficult it is, but if it is a simple fix I would appreciate any help!
Whilst I'm here, another issue with the modal box I'm having is getting it to close once the submit button has been clicked. Currently, the reply is inserted to the thread, but the modal box remains open. Is anyone able to tell me how to close the modalbox once the submit button has been clicked?
Many thanks!
I am using this tutorial to create a modal quote post. Allow me to elaborate; when the user clicks "reply to this post" (traditionally the quote/reply button), instead of taking them to newreply.php, it opens up a modal box, where the user can reply to the post. However, I require the content of the post they are quoting to be inserted into the text box automatically.
Here is the contents of my "postbit_quote" template, where I have included the code for the modal popup:
<a name="modal" rel="#respondModal" class="small blue-button" href="newreply.php?tid={$tid}&pid={$post['pid']}">Reply to This Post</a>
<div id="respondModal" class="respondModalBox modalBox" style="width: 580px;">
<div class="modalContent respondModalContent">
<form method="post" action="newreply.php?tid={$tid}&processed=1" name="quick_reply_form" id="quick_reply_form">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<input type="hidden" name="subject" value="RE: {$thread['subject']}" />
<input type="hidden" name="action" value="do_newreply" />
<input type="hidden" name="posthash" value="{$posthash}" id="posthash" />
<input type="hidden" name="quoted_ids" value="" id="quoted_ids" />
<input type="hidden" name="lastpid" id="lastpid" value="{$last_pid}" />
<input type="hidden" name="from_page" value="{$page}" />
<input type="hidden" name="tid" value="{$tid}" />
<input type="hidden" name="method" value="quickreply" />
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<thead>
<tr>
<td class="thead" colspan="2">
<div class="expcolimage"><a rel="closeModal" href="#"><img style="vertical-align: middle;" src="{$theme['imgdir']}/close.png" /></a></div>
<div><strong>{$lang->quick_reply}</strong></div>
</td>
</tr>
</thead>
<tbody style="{$collapsed['quickreply_e']}" id="quickreply_e">
<tr>
<td class="trow1">
<div style="width: 99%; max-width: 99%;">
<textarea style="width: 100%; padding: 4px; margin: 0;" rows="8" cols="80" name="message" id="message" tabindex="1"></textarea>
</div>
<div class="editor_control_bar" style="width: 95%; padding: 4px; margin-top: 3px; display: none;" id="quickreply_multiquote">
<span class="smalltext">
{$lang->quickreply_multiquote_selected} <a href="./newreply.php?tid={$tid}&load_all_quotes=1" onclick="return Thread.loadMultiQuoted();">{$lang->quickreply_multiquote_now}</a> {$lang->or} <a href="javascript:Thread.clearMultiQuoted();">{$lang->quickreply_multiquote_deselect}</a>.
</span>
</div>
</td>
</tr>
{$captcha}
<tr>
<td colspan="2" align="center" class="tfoot"><input type="submit" class="button" value="{$lang->post_reply}" tabindex="2" accesskey="s" id="quick_reply_submit" /> <input type="submit" class="button" name="previewpost" value="{$lang->preview_post}" tabindex="3" /></td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
This set up allows you to reply to the thread no problem, but I am unsure of how to get the quoted post to be inserted automatically. I have no idea what it entails or how difficult it is, but if it is a simple fix I would appreciate any help!
Whilst I'm here, another issue with the modal box I'm having is getting it to close once the submit button has been clicked. Currently, the reply is inserted to the thread, but the modal box remains open. Is anyone able to tell me how to close the modalbox once the submit button has been clicked?
Many thanks!