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
I hope this helps,
Jjoe
actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options