[albatross-users] al-input type="image" with variable src

Matt Goodall matt at pollenation.net
Tue Feb 24 22:21:56 EST 2004


On Tue, 2004-02-24 at 09:25, Cameron Blackwood wrote:

[snip]

> Im trying to make an array of graphic buttons, each clickable.
> (I dont care about the x,y coords of the click, I just want an
> 
> The trouble is that the buttons src="" isnt constant, but rather needs
> to be dynamically generated.
> 
> <al-input type="image" src="foo(3,4)" name="button-at" value="3,4">
> <al-input type="image" src="foo(3,5)" name="button-at" value="3,5">
> <al-input type="image" src="foo(3,6)" name="button-at" value="3,6">
>                             ^^^^^^^^
> 
> 
> My brain is stalling on how to make the src="" looked up in the
> context. I have a feeling that Ill be slapping my forhead once i find
> out, but currently it scapes me. (See, I am actually _really_ rusty).

Hmm, al-input does not have a srcexpr attribute so it's not going to be
as nice as it could be. However, something like this (untested) should
work:

<al-input
    type="image"
    src="<al-value expr="foo(3,4)"/>"
    name="button-at"
    value="3,4" />

I assume foo is some function you have made available in the context.

Alternatively, you could write a custom tag that understands a srcexpr
attribute. There's a custom tag example in the wiki and albatross.tags
is fairly straightforward.

> 
> I guess I could wrap a whole lot of <al-img>'s in <al-a>'s, but id
> really rather not.

That would be quite different anyway - it would not submit the form.

Cheers, Matt
-- 
Matt Goodall, Pollenation Internet Ltd
w: http://www.pollenation.net
e: matt at pollenation.net

Any views expressed are my own and do not necessarily reflect
the views of my employer.




More information about the Albatross-users mailing list