# \[Pro\] Newbe Old Timer

**URL:** <https://discourse.softpress.com/t/pro-newbe-old-timer/5804>\
**Category:** ActionsDev\
**Created:** [September 18, 2009, 7:07pm UTC](https://discourse.softpress.com/t/pro-newbe-old-timer/5804 "2009-09-18T19:07:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Nikisher](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/m/90db22/32.png) [@Michael\_Nikisher](https://discourse.softpress.com/u/Michael_Nikisher)\
**Post date:** [September 18, 2009, 7:07pm UTC](https://discourse.softpress.com/t/pro-newbe-old-timer/5804/1 "2009-09-18T19:07:04Z")

</div>

Coming out of a two year retirement after 23 years of software engineering and I am totally lost trying to make sense of Freeway Actions. The last two years of my “career” was spent writing corporate websites (front end and back end) using GWT and mySQL so I was once familiar with JavaScript. I need to see some simple examples of how one handles object events using Actions. For example, how does one hook a button onClick event? If there is some Freeway documentation that explains this please point me at it.

* * *

actionsdev mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![jmuscara](https://discourse.softpress.com/user_avatar/discourse.softpress.com/jmuscara/32/52_2.png) [@jmuscara](https://discourse.softpress.com/u/jmuscara)\
**Post date:** [September 19, 2009, 12:37am UTC](https://discourse.softpress.com/t/pro-newbe-old-timer/5804/2 "2009-09-19T00:37:32Z")

</div>

I haven’t actually downloaded anything from the site recently, but I’m pretty sure you can find all you want at this link. Don’t forget the Tech Notes.

[http://www.softpress.com/kb/categories/Actions/Writing+Actions/](http://www.softpress.com/kb/categories/Actions/Writing+Actions/)

* * *

actionsdev mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![Joe2](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/j/3e96dc/32.png) [@Joe2](https://discourse.softpress.com/u/Joe2)\
**Post date:** [September 19, 2009, 8:07am UTC](https://discourse.softpress.com/t/pro-newbe-old-timer/5804/3 "2009-09-19T08:07:43Z")

</div>

On 18 Sep 2009, at 20:07, Michael Nikisher wrote:

> I need to see some simple examples of how one handles object events  
> using Actions. For example, how does one hook a button onClick  
> event? If there is some Freeway documentation that explains this  
> please point me at it.

Do you mean to a button in the Actions interface or on the resulting  
HTML? If the former, this will add a button parameter to the interface  
in Freeway (in the Actions palette for that particular Action):

```
<action-button name="myButton" title="Do something"  

```

onclick=“someFunction()” /\>

Where someFunction() is a function in the Action that does something  
(as opposed to the resulting HTML). If the latter, this will add an  
onclick attribute to an item in the tag stream (that gets created on  
publish, in order of the page). It will also assume that you are using  
an item action (one that is applied to items) and it is applied to a  
button item:

```
var inputItem = fwDocument.fwTags.fwFind("input", fwItem); // Find  

```

the button in the item  
inputItem.onclick = fwQuote(someFunction()); // Apply the onclick  
attribute to the input item

You will of course need the function to be added to the page too. This  
can be done like this:

```
var js = fwDocument.fwTags.fwFind("head").fwAddJavaScript(); // Find  

```

an open JS block in the head (or create one if none exist)  
js.fwAddRawOpt(“function someFunction() {”);  
js.fwAddRawOpt(“// Do something”);  
js.fwAddRawOpt(“}”);

Don’t forget to look at the wiki:

[http://actionsforge.com/wikis/view/12-actions-api](http://actionsforge.com/wikis/view/12-actions-api)

I hope this helps,

Jjoe

* * *

actionsdev mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![Michael\_Nikisher](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/m/90db22/32.png) [@Michael\_Nikisher](https://discourse.softpress.com/u/Michael_Nikisher)\
**Post date:** [September 19, 2009, 1:01pm UTC](https://discourse.softpress.com/t/pro-newbe-old-timer/5804/4 "2009-09-19T13:01:40Z")

</div>

Thank you Joe and Joe! The tech notes and the Wiki have cleared up my befuddlement.

* * *

actionsdev mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)
