There are four ways to send events to an ActionFlow controller.
Any ActionFlow controller views can easily use these helper methods to create views that interact with the ActionFlow framework. To have all the details, consult the BaseHelper API.
Links sending events can be created as follows.
<%= flow_link_to :caption, :event_name %>
This would produce the following code.
<a href="/links?flow_exec_key=[key value]&_submit__event_event_name=_event_event_name">caption</a>
See the API for more details and configuration options.
Forms sending events can be created as follows.
<%= flow_form_tag %> <!-- My inputs... --> <%= flow_submit_tag 'caption 1', :first_event %> <%= flow_submit_tag 'caption 2', :second_event %> <%= end_flow_form_tag %>
This would produce the following code.
<form action="/simple_form" method="post"> <input name="flow_exec_key" type="hidden" value="[key value]" /> <input name="_submit__event_first_event" type="submit" value="caption 1" /> <input name="_submit__event_second_event" type="submit" value="caption 2" /> </form>
See the API for more details and configuration options.
AJAX links sending events can be created as follows.
<%= flow_link_to_remote 'caption', 'event_name', :update => 'domElementId' %>
This would produce the following code.
<a href="#" onclick="new Ajax.Updater('link', '/ajax?flow_exec_key=[key value]&_submit__event_event_name=_event_event_name', {asynchronous:true, evalScripts:true}); return false;">caption</a>
See the API for more details and configuration options.
ActionFlow is fully compliant with Rails RJS functionnality. If you master RJS, you’ll understand.
AJAX forms sending events can be created as follows.
<%= flow_form_remote_tag :update => :form %> <!-- My inputs... --> <p><%= flow_submit_tag 'Update', :update %></p> <p><%= flow_submit_tag 'Quit', :quit %></p> <%= end_flow_form_tag %>
This would produce the following code.
<form action="/ajax" method="post" onsubmit="new Ajax.Updater('form', '/ajax', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;">
<input name="flow_exec_key" type="hidden" value="[key value]" />
<p><input name="_submit__event_update" type="submit" value="Update" /></p>
<p><input name="_submit__event_quit" type="submit" value="Quit" /></p>
</form>
See the API for more details and configuration options.
~~DISCUSSION~~
This work is licensed under a
Creative Commons Attribution-Share Alike 3.0 License.