Child pages
  • WOActiveImage
Skip to end of metadata
Go to start of metadata

Introduction

A WOActiveImage displays an image within the HTML page. If the WOActiveImage is disabled, it simply displays its image as a passive element in the page. If enabled, the image is active; that is, clicking the image generates a request.

WOActiveImages are intended to be used outside of an HTML form. WOActiveImage functions as a mapped, active image. When the user clicks in a WOActiveImage, the coordinates of the click are sent back to the server. Depending on where the user clicks, different actions are invoked. An image map file associates actions with each of the defined areas of the image. If an image map file is not specified, the method specified by the action attribute is performed when the image is clicked, or if the href attribute is specified, the image acts as a hyperlink and takes you to that destination.

Within an HTML form, a WOActiveImage functions as a graphical submit button. However, it is better to use a WOImageButton instead of WOActiveImage to create a graphic submit button or a mapped image within a form.

Generated HTML

When you use WOActiveImage, it will generate a <img> tag surrounded by a <a href> tag, like this:

<a href="/cgi-bin/WebObjects/DynamicElements.woa/wo/nSZJRma4bnNG7UdGL12KDw/3.1" name="1"><img border="0" ismap="ismap" src="/WebObjects/DynamicElements/WebServerResources/WO.jpeg" width="180" height="180"></a>

Usage

WOActiveImage {
  filename= imageFileName;
  [framework = frameworkBaseName|"app";] |
  src=aURL; |
  value=aMethod;
  action=aMethod |
  href=aURL |
  actionClass=aClass |
  directActionName=aName; |
  data=dataObject;
  mimeType=typeString;
  [key=cacheKey;]
  [imageMapFile=aString];
  [name=aString;]
  [x=aNumber; y=aNumber;]
  [target=frameName;]
  [disabled=aBoolean;]
  [secure=aBoolean;]...}

Bindings

filename

Path to the image relative to the WebServerResources directory.

framework

Framework that contains the image file. This attribute is only necessary if the image file is in a different location from the component. That is, if the component and the image file are both in the application or if the component and the image file are both in the same framework, this attribute isn't necessary. If the image file is in a framework and the component is in the application, specify the framework's name here (minus the .framework extension). If the image file should be in the application but the component is in a framework, specify the "app" keyword in place of the framework name.

src

URL containing the image data. Use this attribute for complete URLs; for relative URLs use filename instead.

value

Image data in the form of a WOElement object. This data can come from a database, a file, or memory.

action

Method to invoke when this element is clicked. If imageMapFile is specified, action is only invoked if the click is outside any mapped area. In other words, action defines the default action of the active image.

href

URL to direct the browser to as a default when the image is clicked and no hot zones are hit.

actionClass

The name of the class in which the directActionName can be found. Defaults to "DirectAction".

directActionName

The direct action method to invoke when the URL is accessed (minus the "Action" suffix). Defaults to "default".

data

Specifies an image resource in the form of an NSData; this data can come from a database, a file, or memory. If you specify resource data, you must specify a MIME type.

mimeType

A string designating a MIME resource type, such as "image/gif", to be put in the content-type header field; this type tells the client what to do with data. If you provide data but no MIME type, an exception is thrown.

key

A string that the application uses as a key for caching the data specified in data. If you do not provide a key, the data object must be fetched each time it is needed. For further information, see the reference documentation for the WOResourceManager class, (in particular, see the flushDataCache method).

imageMapFile

Name of the image map file. See "The Image Map File" (page 17) for more details.

name

If name is specified then the hit point is specified as name.x=value; name.y=value; in the form. This is useful when you need to use this element to
submit a form to an external URL that expects the hit point to be expressed in a certain format.

x, y

If specified, returns the coordinates of the user's click within the image.

target

Frame in a frameset that will receive the page returned as a result of the user's click.

disabled

If disabled evaluates to true, a regular image element (<IMG>) is generated rather than an active image.

secure

Changes the URL prefix from http to https when WebObjects generates URLs for component actions and direct actions for this element. For this attribute to have any effect, you must provide bindings either for the action, directAction, actionClass, or pageName attribute (respecting the valid combinations).

alt

Specify a tooltip (string) on the image. It adds the "title" attribute to the generated <a> tag. Project Wonder addition (Wonder will automatically switch to ERXActiveImage if you extend from ERXApplication).

Examples

Java methods

WOD-style

 

Inline bindings (WOOGNL)

Calling a method "doSomething" with an image named "WO.jpeg" coming from the Web server resources:

<wo:WOActiveImage action="~doSomething" filename="WO.jpeg" />

Calling a method "doSomething" with an image coming from a NSData object (image stored in a BLOB object from the database):

<wo:WOActiveImage action="~doNothing" data="$myEO.imgData" mimeType="image/jpeg"  />

Related documents

ERXActiveImage

  • No labels