[albatross-users] Auto list bug/issue...

Michael C. Neel neel at mediapulse.com
Sat Feb 21 03:21:55 EST 2004


I've come across a strang which is in 1.11+, maybe prior versions as
well but I didin't check them.

Normally, if you try to have several form fields defined with the same
name, you either need to use the "list" argument on the tags, or make
the list in the page object/module.  This is very nice, because
albatross doesn't pull an perl like bs of thinking for you, and letting
some bug creep into production because it never caused a problem when
testing.

However, if you name several fields the same name, but they are
different types, you can get a field that will sometimes be a list,
sometime a string.  To show this, here is a simple template that will
show the problem:

<html>
<body>
<al-form method="post">
    <al-select name="selbox">
        <al-option>Select1</al-option>
        <al-option>Select2</al-option>
        <al-option>Select3</al-option>
        <al-option>Select4</al-option>
        <al-option>Select5</al-option>
    </al-select>
    <br>
    <al-input type="radio" name="selbox" value="Radio1">Radio1<br>
    <al-input type="radio" name="selbox" value="Radio2">Radio2<br>
    <br>
    <al-input type="submit" name="submit" value="submit">
</al-form>
<br>
<b>selbox:</b> <al-value expr="locals().get('selbox')">
</body>
</html>

if you just submit, selbox is a string og the select box choice.  If you
also select a radio, selbox is a list of the select box choice and the
radio choice.  If you change either of the radio buttons to checkboxes
you will get the  (excpected) traceback error that selbox is not defined
as a list.

Normally I would dig into the source to find out what's going on, but
since I'm pressed for time I thought I'd just send this now and if need
be I can dig deeper later.

Mike



More information about the Albatross-users mailing list