Button Event Handler within a template

I need to make the template visibility false, when a button is clicked inside the template. I guess I am having issues with component hierarchy.
The ‘Cancel’ button is to make the template invisiblle.
This is what I have right now. Thanks!

event.source.parent.getComponent('abort_template.Container').visible = False 

``

<img src="//discourse-cloud-file-uploads.s3.dualstack.us-west-2.amazonaws.com/business4/uploads/inductiveautomation/original/2X/6/623c988a07640586e86968fa435dadceef5fac9a.PNG" width="501" height="500">

Two things:

  1. The getComponent() method can only access one level at a time. No dot allowed.
  2. The button’s parent is already Container. No need to use getComponent() at all.

Try this:

event.source.parent.visible = False
1 Like