We want to display our ‘ArticleEdit’ Form when a user clicks the ‘Add an article’ button. We’ll use Events for this.

Click on ‘Homepage’ in the App Browser and choose the Design view to go back to your UI.

Click on the ‘Add an article’ Button, and scroll to the bottom of the Properties Panel. You’ll see a list of events for the Button. Click the blue arrows next to ‘click’ to set up a click event handler.

Adding a click handler to the 'Add an article' Button from the Properties pane.

Configuring a click event handler from the Properties pane.

This will open up the code for the Form in Split view (you can always choose the Code tab above the Form to make the code editor full screen). Clicking the blue arrows has set up a method called add_article_button_click that looks like this:

def add_article_button_click(self, **event_args):
  """This method is called when the button is clicked"""
  pass

This is the Python method that runs when the ‘Add an Article’ Button is clicked.

When someone clicks this button, we want to display a popup Form that users can fill out to save a new article. We do this using Alerts.

To display a simple alert, change your click handler to trigger an alert as follows:

def add_article_button_click(self, **event_args):
  # Display a popup that says 'You clicked the button'
  alert("You clicked the button")

To see it in action, click the ‘Run’ button at the top of the screen:

Location of the Run button

You’ll see your app running. Click the ‘Add an article’ button and your popup should appear!

An alert saying 'You clicked the button'.