[albatross-users] Need some hints on: filling in a grid

Gregory Bond gnb at itga.com.au
Fri Feb 27 17:30:33 EST 2004


I have an application where the user needs to fill in some entries on a grid.  
Typical size might be 20 rows by 5 columns, and maybe 20% of the squares would 
need to be entered. (If it helps, the entries should all be integers > 0).

I'm struggling to find a natural way to handle this in Albatross.

My first cut did something like this:

 <al-for iter="r" expr="range(rows)">
   <tr>
     <al-for iter="c" expr="range(cols)">
	<td>
          <al-input type="text" namexpr="'r%dc%d' % (r.value(), c.value())" />
        </td>
etc

This has 3 problems, more or less, as it stands:

- Finding out which cells are entered is awkward:
	for r in range(rows): 
	  for c in range(cols):
	    v = getattr(ctx.locals, 'r%dc%d' % (r, c))
	    if v: 
	      # Do stuff
	      # may need to be "v is not None" depending on blanks etc

- If I discover an error in the page_process() (i.e. mis-typed cell contents),
then redisplaying the page without navigating to a new one blanks all the
cells.  This is a surprise.....  and a pain if if forces a bunch of re-typing.
It seems the "fill in the default value from ctx.locals" is not working for
al-input when nameexpr is used instead of name?

- (this is a web problem more than an Albatross problem...) When typing in a 
cell, the browser keeps "helpfully" suggesting possible completions in little 
tool-tip-like boxes.  This is a HUGE PITA.

Any clues or ideas?






More information about the Albatross-users mailing list