How to trigger function on the click of Solution Button

Hi All,

We are using discourse-solved plugin for accepting answers from the Users.
Now we have to display/hide a popup at the bottom whenever the user accepts/unaccepts a reply as an answer by clicking on the Solution button. How we can do this?

image

Thanks.

1 Like

Hi Saurabh,

I’m not quite sure I understand what you’re asking. Can you explain what you mean by that? Maybe use a mockup if that’s easier?

Why do you want to display/hide a popup? What information do you want to display in that popup?

Thanks

Hi @zogstrip,

Thanks for the reply. We got the solution.

Here we have to display a popup similar to a cookie notice (i.e. fixed at the bottom) on the Topic page if the logged-in user is the author of the topic and none of the replies is marked as Solution.
And whenever the topic author checks/unchecks the reply as Solution then hides/shows the popup.

So for this, we have created a widget that returns the popup (say: accept-answer-popup) only based on the required conditions (as I mentioned above) and attached it after the post-stream widget.

By this whenever the topic author checks/unchecks the reply as Solution then the post-stream widget is refreshed and also the accept-answer-popup is refreshed as they are in the chain. This solved our problem.

Please give us feedback if we are missing anything in our implementation.

3 Likes

Looks like a good solution :+1:

5 Likes