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, False) >>> 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. These are saved as attributes
of the field.
For example, if an image input named map was clicked by the user, then the code to detect and process the input would look something like this:
def page_process(ctx): if ctx.req_equals('map'): map_clicked_at(ctx.locals.map.x, ctx.locals.map.y)