# Actions in templates

**URL:** <https://forum.inductiveautomation.com/t/actions-in-templates/5835>\
**Category:** Ignition\
**Created:** [February 8, 2013, 7:57pm UTC](https://forum.inductiveautomation.com/t/actions-in-templates/5835 "2013-02-08T19:57:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [February 8, 2013, 7:57pm UTC](https://forum.inductiveautomation.com/t/actions-in-templates/5835/1 "2013-02-08T19:57:40Z")

</div>

I’m creating a template with a number of dropdowns in it. I have a clear button to reset them all. This all works fine.

My problem is I want to be sure that they are all cleared when the screen the templates are one is first opened up.

How can I reach into a template with code and cause stuff to happen?

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [February 8, 2013, 8:34pm UTC](https://forum.inductiveautomation.com/t/actions-in-templates/5835/2 "2013-02-08T20:34:39Z")

</div>

It’s looks like you access a input control in a template from outside the template.

I’m I just doing this all wrong or have I missing something…

---

<div class="post-metadata">

**Author:** ![James.Lorenz](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/james.lorenz/32/3290_2.png) [@James.Lorenz](https://forum.inductiveautomation.com/u/James.Lorenz)\
**Post date:** [February 11, 2013, 9:01pm UTC](https://forum.inductiveautomation.com/t/actions-in-templates/5835/3 "2013-02-11T21:01:50Z")

</div>

Here’s how you access a template component, this example coming from a button on the same window as the template. The getComponent(0) is the gotcha:

```auto
event.source.parent.getComponent("Template").getComponent(0).getComponent("Dropdown")
```

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [February 11, 2013, 9:12pm UTC](https://forum.inductiveautomation.com/t/actions-in-templates/5835/4 "2013-02-11T21:12:28Z")

</div>

Sneaky…

but it works ![:thumb_right:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/2026e28c0c425034352c1b75807edf956adc75f4.gif ":thumb\_right:")
