[albatross-users] onRequest() & pagination

Dave Cole djc at object-craft.com.au
Thu Apr 3 10:54:29 EST 2003


>>>>> "Francis" == Francis Meyvis <francis.meyvis at sonycom.com> writes:

Francis> Question 1 I've this (simplified) form like this
Francis> <al-form method="post" action="?filterSelect=filterSelect">
Francis>  <al-select name="prjFilterSelect" optionexpr="filterMenu"
Francis>             onChange="this.form.submit()"/>
Francis> </al-form>

Francis> The REQUEST_URI, when selecting something from the popup
Francis> menu, arriving in my cgi-application has the correct
Francis> parameters at the end (something like
Francis> "...?filterSelect=filterSelect").  But my context does not
Francis> recognize it as a req_equals().  Is this normal or I'm a
Francis> misunderstanding something?

It is normal (unfortunately).  The problem is caused by Albatross
recording the form elements constructed via <al-input> tags, then
restricting browser request merging to the values named in the
<al-input> tags.  Currently the <al-form> tag does not try to parse
the action attribute to determine if there are additional values which
should be accepted from the browser request.

Francis> If I add next form element, the request is recognized however
Francis> (I just tried this, I have no explanation)
Francis> <al-input type="hidden" name="filterSelect" value="Select filter"/>

This makes the field "filterSelect" visible to the form recording
process which occurs during <al-form>/<al-input> template expansion.
This is explained at the bottom of this page (look for the text
"__albform__"):

    http://www.object-craft.com.au/projects/albatross/albatross/fig-popview-sitemap.html

Francis> Question 2 This is related to pagination. The paginated list
Francis> looks like this

Francis> <Prev 8 PAGE 2 Next 8>

Francis> [] item 9
Francis> [x] item 10
Francis> [x] item 11
Francis> [] item 12 ...
Francis> [] item 16

Francis> The check box options are remembered in a variable
Francis> "selections".  Is there a trick to remember the items that
Francis> where selected in pages 1, 3, etc?  Now the cgi-application
Francis> when inspecting "selections" only sees item 10 and 11 while
Francis> actually also items 5, 6, 17, 20 were.

You don't really give enough information here so I will present one
way in which you could solve this problem (untested).

        ctx.locals.items = [...]
        ctx.locals.selected = ['10', '11']
        ctx.add_session_vars('selected')

        <al-for iter="i" expr="items" pagesize="20">
          <al-input type="checkbox" name="selected" valueexpr="i.index()">
          item <al-value expr="i.index()"><br>
        </al-for>

- Dave

-- 
http://www.object-craft.com.au




More information about the Albatross-users mailing list