XF 2.0 Overlay confirmation message

AndyB

Well-known member
In my Bookmark add-on, I would like to show a confirmation message the same way the Report link does after you click the Report button, a drop down "Thank you for reporting this content" is display for a few seconds.

1516540002842.webp

I'm extending the post controller and using the following template code:

Code:
<a href="{{ link('posts/bookmark', $post) }}"
    class="actionBar-action"
    data-xf-click="overlay">{{ phrase('bookmark_bookmark') }}</a>

The add-on works perfect except that there's no confirmation message. What code am I missing?

Thank you.
 
After I save the bookmark information my PHP code ends with:

PHP:
$confirmation = \XF::phrase('your_bookmark_has_been_saved');
return $this->redirect($this->buildLink('posts', $post), $confirmation);
 
Is data-skip-overlay-redirect="true" attribute set for your form?

Thank you kindly, Pat. That's what was missing.

This now works.

Code:
<xf:title>{{ phrase('bookmark_bookmark') }}</xf:title>

<xf:form action="{{ link('posts/bookmarksave', $post) }}" class="block" ajax="true" data-skip-overlay-redirect="true">
	<div class="block-container">
		<div class="block-body">
			<xf:textboxrow label="{{ phrase('bookmark_note') }}" name="note"
				value="{$note}" maxlength="100" dir="ltr" autofocus="autofocus" />
			<xf:checkboxrow standalone="true"><xf:option name="delete_bookmark" label="{{ phrase('bookmark_delete_bookmark') }}" /></xf:checkboxrow>
		</div>
		<xf:submitrow submit="{{ phrase('bookmark_submit') }}" />
	</div>
</xf:form>
 
Top Bottom