[albatross-users] Albatross Macros and Form Elements

Damien Elmes alb-users at repose.cx
Wed Dec 3 09:53:52 EST 2003


Gabriel Cooper <gabriel.cooper at mediapulse.com> writes:

> I have a macro containing form elements, such as:
>
> <al-macro name="form_text">
> <input type="text" name="<al-usearg value='name'>">
> </al-macro>
>
> but if it's just a normal input type it won't populate form information
> automatically, so I swapped it to be an al-input:

I ran into something like this, if I understand you correctly. I
ended up using a set variable prior to evaluating the macro - ie,
instead of using the setarg/usearg, I'd set the variable prior to
macro evaluation, like:

<!-- Display an individual semester. -->
<!-- Expects a variable called sem -->
<al-macro name="displaySemester">
<table style="border: 2px solid #000;">
<tr bgcolor="#cccccc">
<td bgcolor="#ffffff" style="padding: 20px;">
<span style="font: 150% arial;">
<b><al-value expr="sem['name']" noescape></b>
</span>
</td>
<al-for iter="slot" expr="sem['slots']">
<al-exec expr="
if slot.value()[2]:
    c = '#cccccc'
else:
    c = '#ffcccc'
">
...

An example of code that calls the macro:

<!-- Display all semsters listed in 'semesters' -->
<al-macro name="displayAllSemesters">
<table>
<al-for iter="semIter" expr="semesters">
<tr>
<td>
<al-exec expr="sem = semIter.value()">
<al-if expr="semIter.index() % 2 == 0">
<hr style="background: #FFFFFF; border: 0px;">
</al-if>
<al-expand name="displaySemester"/>
</td>
</tr>
</al-for>
</table>
</al-macro>

Hope this helps and that I've understood your intention correctly.

Cheers,

--
Damien Elmes



More information about the Albatross-users mailing list