Basic Enterprise Application Realm

Basic Enterprise Application Realm Documentation

  • 1 PHP Reference
    • 1.1 Introduction
    • 1.2 shared_lib.php
    • 1.3 ac_tables.php
    • 1.4 ac_email.php
  • 2 Javascript Reference
    • 2.1 Introduction
    • 2.2 ac_ajax
    • 2.3 ac_event
    • 2.4 ac_filter
    • 2.5 ac_menu
    • 2.6 ac_panel
    • 2.7 ac_select
    • 2.8 ac_toc
  • 3 Forms
    • 3.1 Introduction
    • 3.2 How It Works
    • 3.3 AJAX
    • 3.4 form_processor_v2
    • 3.5 form_processor

2.3 ac_event

September 18th, 2025

Provides a mechanism for registering multiple Javascript event functions to a single event. In addition, a standalone function for image preloading is also included. This class can be used directly but is also required by several other of the Javascript class files bundled with BEAR.

Current version: 2
Dependencies: none

2.3.1 Public Properties

None.

2.3.2 Public Methods

Version Arguments Purpose
addEvent 2 ID (string) Registers a HTML element to an event handler. The actual events are handled by proprietary HTML attributes.
ac_preloadImg 2 filenames (array) Preloads all the files (assumed images) in the supplied array. This prevents delays on rollover events where other image states are shown.

2.3.3 HTML Attributes

Version Type Mandatory [Y/N] Purpose
ac:action 2 enumeration N* When this exists, it indicates a specific action to be triggered. Valid values are: link = triggers a URL link; submit = triggers a form submission; layer = triggers the display of a hidden layer. Linking is generally trivial with HTML. This functionality is for creating complex links from HTML elements that generally cannot be used with <a> tags.
ac:link 2 string N When ac:action exists and is set to "link", this attributes contains the URL to be opened on click.
ac:open 2 string N Contains the ID of a layer that is hidden (CSS style is "hidden") which will be made visible on click.
ac:close 2 string N Contains the ID of a layer that is (or will be) visible (CSS style is blank) which will be hidden (CSS style changed to "hidden").
ac:form 2 string N When ac:actionexists and is set to "submit", this attribute contains the ID of the HTML form to submit on click.
ac:layer 2 string N When ac:actionexists and is set to "layer", this attribute contains the ID of a layer that is hidden (CSS style is "hidden") which will be made visible on click. This differs from the simpler use of ac:open in that this is used to create tabbed dropdown menus.
ac:value 2 string N When ac:actionexists and is set to "submit", this optional attribute may contain an alternative string to replace the <form> tag's actionattribute. This is useful for creating forms with multiple submit buttons that should perform different actions on the same set of user input data.
ac:trigger 3 enumeration N Restricts the event to occurring only on the specified condition. Currently, this only supports the keyword "change". Setting thsi would prevent the event from triggering unless the value of the element is changed.

* Items are mutually exclusive. At least one of these must be used.

2.3.4 Usage Example

Linking

Javascript

ac_event.addEvent('mylink');

HTML

<img src="some_image.png" id="mylink" ac:action="link" ac:link="http://www.amazon.com"\>

Submitting a form

Javascript

ac_event.addEvent('alt_submit');

HTML

<input type="button" id="alt_submit" value="Save and Close" ac:action="submit" ac:form="register" ac:value="/my_app/register.acx?action=2">

Opening a layer (menus)

Javascript

ac_event.addEvent('my_layer');

HTML

<img src="open.png" id="my_layer" ac:action="layer" ac:layer="greeting"> <div id="greeting" class="hidden">Hello World</div>

Opening a layer (standard)

Javascript

ac_event.addEvent('my_layer');

HTML

<img src="open.png" id="my_layer" ac:open="greeting"> <div id="greeting" class="hidden">Hello World</div>

Closing a layer

Javascript

ac_event.addEvent('my_layer2');

HTML

<img src="close.png" id="my_layer2" ac:close="greeting"> <div id="greeting>Hello World</div>

Preloading images

Javascript

var $a=['img1.png','img2.png','img3.jpg']; ac_preloadImgs($a);

HTML

None.

previous: ac_ajax next: ac_filter