Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

384 views 23 8
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