We want to display two buttons on our popup: ‘Save’ and ‘Cancel’. We’ll Create new article if the user clicks ‘Save’, and discard the user inputs if they click ‘Cancel’.

We do this by setting the alert’s buttons property, which expects a list of buttons. Each button should be set to a 2-tuple. The first element of each tuple is is the text to display on the button, and the second element is the value returned if the user clicks the button.

Add a buttons property to the alert in your add_article_button_click function:

  def add_article_button_click(self, **event_args):
    # Open an alert displaying the 'ArticleEdit' Form
      title="Add Article",
      buttons=[("Save", True), ("Cancel", False)],

Run your app, and click your ‘Add an Article button’. You’ll see the ArticleEdit Form in a popup, and notice that you have ‘Save’ and ‘Cancel’ buttons.

The alert from before, now with Save and Cancel buttons.