# Create PT - "On Event" question

**URL:** <https://forum.code.org/t/create-pt-on-event-question/24813>\
**Category:** Uncategorized\
**Created:** [February 13, 2019, 3:43pm UTC](https://forum.code.org/t/create-pt-on-event-question/24813 "2019-02-13T15:43:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hcook](https://avatars.discourse-cdn.com/v4/letter/h/278dde/32.png) [@hcook](https://forum.code.org/u/hcook)\
**Post date:** [February 13, 2019, 3:43pm UTC](https://forum.code.org/t/create-pt-on-event-question/24813/1 "2019-02-13T15:43:01Z")

</div>

This is my first year teaching AP CSP. I have read that the students can’t use an “On Event” as an algorithm or abstraction for their Create PT. Can they use a function that has an “On Event” inside of it?

---

<div class="post-metadata">

**Author:** ![zsawyer](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/zsawyer/32/4302_2.png) [@zsawyer](https://forum.code.org/u/zsawyer)\
**Post date:** [March 12, 2019, 12:17am UTC](https://forum.code.org/t/create-pt-on-event-question/24813/2 "2019-03-12T00:17:32Z")

</div>

Yes you could, although you would not place an onEvent inside a function, you would call the function within the onEvent callback function.

If your function has no parameters, it becomes simply:  
onEvent(“id”, “click”, amazingAbstractedAlgorithm);

It may be my poor imagination, but I do not think it would be easy to show an abstracted function that takes no parameters.

> **[Check out what I made](https://studio.code.org/projects/applab/gUTIQcX3OUvrhKkyIK3siNy9rrvQ1nmSt_7qEhmoTiY)**
>
> I wrote the code myself with Code.org

The important thing is that students don’t reference the onEvent that the function is called in, but the function description itself, which in most all cases will be out of the onEvent block.
