5.2.2.16 type="..." attribute (image)

The tag determines the generated name (5.2.2.5) from the name related attributes.

For example:

>>> import albatross
>>> class Ctx(albatross.SimpleContext):
...     def input_add(self, *args):
...         print args
... 
>>> ctx = Ctx('.')
>>> albatross.Template(ctx, '<magic>', '''
... <al-input type="image" nextpage="m" srcicons/right.gif" whitespace>
... ''').to_html(ctx)
('image', 'nextpage,m', None, 0)
>>> ctx.flush_content()
<input type="image" srcicons/right.gif" name="nextpage,m">

After writing all tag attributes the execution context input_add() method is called with the arguments; input field type ('image'), the generated name, None, and a flag indicating whether or not the list (5.2.2.4) attribute was present.

When a browser submits input to an image input it sends an x and y value for the field. Application code should check for either of these when checking if the user clicked the image.

For example, if an image input named map was clicked by the user, then the code to detect the input would look something like this:

def page_process(ctx):
    if ctx.req_equals('map.x'):
        map_clicked_at(ctx.locals.map.x, ctx.locals.map.y)