[CAF] Form state (was Re: who's doing what?)

G. Matthew Rice matt at starnix.com
Thu Oct 20 11:15:50 EDT 2005


Michael Graham <magog at the-wire.com> writes:
> > With that in mind, I'll need make_link (or something) to handle POSTing of
> > forms.  Couldn't make_link just return the checksum and qs info so that it
> > can be placed in a hidden field in the form or something?  I guess that I
> > could make the form's action field have the full link info and just put the
> > user submitted data in POST fields (will that even work?).
> 
> Based on discussions with Richard and Cees Hek, I wrote a module for
> this purpose:
> 
>     http://search.cpan.org/dist/CGI-Application-Plugin-FormState
> 
> It puts a single hidden field in your form:
> 
>     <input type="hidden" name="cap_form_state" value="<tmpl_var cap_form_state>">
> 
> And it uses the value of this field as a key in the user's session where
> the actual data is stored:
> 
>     # save stuff in session
>     $self->form_state->param('name'       => 'Road Runner');
>     $self->form_state->param('occupation' => 'Having Fun');
> 
> 
>     # ... time passes ...
> 
>     # Retrieve some parameters
>     print $self->form_state->param('name');       # 'Road Runner'
>     print $self->form_state->param('occupation'); # 'Having Fun'
> 
> 
> I'm using this system at work in a cgiapp (but non-CAF) system.  Works
> fine for me.  But it requires CAP::Session to work.  See below.

How do the session_id and checksum values work into this?


> > I'm also volunteering to manage the FAQ/HOW-TO, I guess :)
> >
> > 1. How do I allow anonymous users access to the system?  eg. so that they
> >    can register with the database?  It seems that you need to be able to
> >    login before you can do anything else.
> 
> Ultimately, we need to refactor the CAF to use CAP::Session and
> CAP::Authentication.  That will give us anonymous sessions.
> 
> There was at one time an example of how to do this kind of thing with
> the existing system, but I removed it, foolishly thinking that we were
> much closer to having proper anonymous sessions.

Well, I'm happy to do some work on this.  I'm going to need this ability RSN.

Regards,
-- 
g. matthew rice <matt at starnix.com>           starnix, toronto, ontario, ca
phone: 647.722.5301 x242                                  gpg id: EF9AAD20
http://www.starnix.com              professional linux services & products



More information about the caf mailing list