It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is there any way I can create a modal popup when a user clicks the save or update buttons on a page so that I can ask them to add a piece of required supporting information for the page?

My use case is that every page is required to have a banner detailing if it is commercially sensitive or one of another few caveats. I don't want to rely on people adding labels etc after the page was saved, I'd rather make it a required field somehow. 

I've seen a confluence instance with a pop up that appears on clicking the save button which opens a dialog / modal area, asks you to fill in a form then saves the page with that extra info. I've no idea how they've done it though.

The closest I've gotten is a on page save event on the server side, but can't figure out how to do this client side.

Any ideas? 

1 answer

As far as I'm aware there is no real API for this in the frontend. You'll have to come up with your own solution. A possible hack could be to kidnap the original save button and replace it with your own, like this:

AJS.toInit(function() {
var $original = $('#rte-button-publish');
var $clone = $original.clone();

$original.hide().attr('id', '#rte-button-publish-original');
$clone.insertAfter($original);

$clone.on('click', function(e) {
e.preventDefault();
// replace with your own dialog/logic.
var shouldSave = confirm('bla bla bla');
if (shouldSave) $original.click();
});
});

This should be fine if you only use this internally, but please don't put something like this into a Marketplace app! ;)

Cheers,
Sven

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

How is your team having fun and bonding, remotely, utilizing Confluence?

Thanks everyone for answering last week’s question. The winner of the random drawing from those who commented is: @LarryBrock I’ll contact you separately with your prize details. This wee...

306 views 9 7
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you