[albatross-users] revisiting checkboxes..

Eric S. Johansson esj at harvee.org
Thu Jun 26 12:01:17 EST 2003


Andrew McNamara wrote:

> That's still possible - essentially that's what you're using in option 3,
> although my example went further, by using the namespace merging.

and I'm trying to puzzle it out ;-)

> BTW, in my example, the <al-input> should be:
> 
>         <al-input type="checkbox" value="on" 
>                 nameexpr="'spamtrap_tokens.' + token_i.value()">

I'll need to think about this one when I'm more awake (gmt-4 here and I am up a 
bit past my bedtime).

> The HiddenField session mixin store the application context in a hidden
> input field. I've regularly used this with many kilobytes in the context
> with a number of browsers (IE 5.5, IE 6, Mozilla 1.0, Opera, etc, albeit
> all modern browsers - I've given up on Netscape 4 aged rendering model
> and security problems).

fair enough.  That might make it a viable option then

>>what I used to do was stick a prefix in front of each spamtrap token and
>>make that the name.  The value would be the spamtrap token.  After they
>>submit button press, I would look through all the returned values for the
>>prefix and check for the checked or unchecked state.  I was hoping for
>>something equivalently simple.
> 
> 
> Essentially, you're just after a boolean checked/unchecked value for
> each token, yes? You don't need to do anything as complex as setting
> the input value to the token, as well as having the token in the name -
> a simple value="on" should be enough.

yes basically all I care about is being able to set the checkbox state (on/off) 
and to retrieve the token and the checkbox state.

> What's happening here is the nameexpr is being evaluated to yield the name
> of '6212922bbc33af37', which is then evaluated again to get to input value
> (which is where the exception is raised).
> 
> You could prepend something to the token (as you suggest earlier) to make
> it a valid python expression (albeit one that raises an AttributeError,
> which is ignored by albatross):
> 
>     <al-input type="checkbox" name="'token' + spamtrap_token">
> 
> Setting an explict value="on" attribute will also prevent the error.

OK, since I'm giving everything else a shot, I might as well try this.

> The rules and relationships between name, nameexpr, value and valueexpr 
> are really too complex for meer mortals (me included).

so I've gathered...

---eric






More information about the Albatross-users mailing list