Click out of alert without triggering action?

What I’m trying to do:

I have an alert which is triggered by the pressing of a button in a repeating panel. The alert contains two buttons, that when clicked, open up a new webpage. However, when a person clicks out of the alert (without clicking on any of the buttons), a new webpage still opens up, even though the alert should simply be dismissed and the user should arrive back at the page containing the repeating panel table.

What I’ve tried and what’s not working:

Code Sample:

TA = RichText(content=res_text.replace("\t",""))
#     TA = TextArea(auto_expand=True,
#                  text=self.item['dump_resume'])
    result = alert(buttons=['Open Resume','Open Linkedin'],content=TA,
                  content2 = RichText(content="res_text"),
              title=f"Resume Text",
              large=True)
  
    if alert(buttons=['Open Resume','Open Linkedin'])== "Open Resume":
      window.open(fin_resume_link)
    else:
      window.open(fin_linkedin_link)` 

Clone link:
share a copy of your app

You have three options. The alert returns “Open Resume”, the alert returns “Open Linkedin”, or the alert returns None. Your if statement only has two options, the if and the else. It’s opening the LinkedIn link for both “Open Linkedin” and None. Put an elif in there for the third option.

1 Like