[albatross-users] revisiting checkboxes..

Eric S. Johansson esj at harvee.org
Thu Jun 26 11:22:31 EST 2003


Andrew McNamara wrote:

> One way or another you will have to carry the list of "unchecked"
> boxes across.

when I use straight HTML, I don't have to.  It's possible to encode all the 
information in the name and value fields such that you can extract a list of 
checked and unchecked entries in a single pass.


> Some options include:
> 
>  - putting the full list into the execution context (ctx.locals), provided
>    you're using a stateful application model.
>  - putting the full list into a hidden field - I'm not sure why you suggest
>    this is unpleasant - it's quite easy to do, and it will work with the
>    non-stateful application model.
>  - using separate names for each checkbox via the nameexpr attribute.

thanks for the options.  I'm probably going to try something like the last one 
although I am having troubles with names.  I considered the full list in a 
hidden variable unpleasant because at some point, you run out of room and you 
really don't know where that limit is.  Each entry is 16 characters long not 
including separator and it's possible for the user to configure the system so 
that there are a few hundred entries visible on the screen.  It wouldn't be wise 
but they can do it.  At what point does a hidden variable run out of room and 
how does that manifest?  Are the limits the same for all browsers?  Therefore, I 
prefer less fragile options.

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.

I like your idea of using separate names that you detailed.  As I stated above, 
I'm having trouble with names and it looks a little weird.  For example, I have 
a simple variable called "spamtrap_token" and it looks like this: 6212922bbc33af37
if I refer to it simply as """<al-input type="checkbox" name="spamtrap_token" 
""" the name is not translated.  If I instead refer to it as """<al-input 
type="checkbox" nameexpr="spamtrap_token" """ I get an error stating:

    return eval(name, {}, self.locals.__dict__)
   File "<string>", line 1
     6212922bbc33af37
                    ^
SyntaxError: unexpected EOF while parsing

since it's just a string, it doesn't have a value method and albatross is not 
afraid to tell me so.

thank you for your suggestions, I'll will play with them and see what happens.

---eric





More information about the Albatross-users mailing list