RW_IMAGE_BUTTON


Purpose

Defines a button that has an image on its face. An image button operates in the same way as a Submit button: when a user clicks an image button, data from the form is sent to the server for processing. (However, if you want to associate client side processing with an image button, in the same way as with an ordinary push button, see the Remarks section below.)

The routine captures the coordinates of the point in the image that is clicked, and saves them in form fields called Name.x and Name.y which are submitted for processing with the rest of the form's data. This means that the server can take different actions according to where in the image the user clicks.

This routine outputs directly to RealWeb's RWC.OUTBUF buffer.

Syntax

RW_IMAGE_BUTTON(Name, Description, ImageURL, aClass)

Parameters

Name Name of the image button.

Description Specifies text for the image button, to be displayed if a user's browser has been set to not display pictures.

ImageURL of the image that is to appear on the button.

aClass A dynamic array that can contain the following elements:

Element No.

Attribute

Description

1

CLASS

The name of a tag class defined in a stylesheet.

2

ALT

Alternative text that is displayed instead of the image, if image display is not possible or disabled by the user.

This must be a text string of up to 1024 characters. It can contain entity references to special characters, but cannot contain any other sort of markup; in particular, no style tags are allowed.

Attributes defined in the aClass parameter are applied to the INPUT tag.

For information about using aClass, see The aClass Parameter.

Dependencies

Requires a previous call to RW_START_HTML_FORM.

Remarks

If you do not want the form to be submitted when the user clicks the image button, you must supply an onClick event handler which returns false within the aClass parameter. This can run a function to carry out client side processing (see RW_BUTTON). For example:

CLASS<3> = "onClick='processClick(this); return false;'"

Note the use of the return  keyword in the event handler definition.