Re: [Templates] Objects as hidden variables?

[prev] [thread] [next] [Date index for 2004/12/17]

From: Sean Kellogg
Subject: Re: [Templates] Objects as hidden variables?
Date: 17:16 on 17 Dec 2004
The limitation here is not with template toolkit, but the HTML get and post 
methods.  Consider the following:

<form>
 <input type='text' name='session' value='3>
 <input type='hidden' name='uid' value='6'>
</form>

When that form is submitted, all the browser does is concatenate it into one 
big URL string like this:

index.cgi?session=3&uid=6

The more form elements you add, the more stuff gets concatenated to the end of 
the URL string.

Why your attempt won't work is that an object is not a string...  the variable 
[% session %] includes other stuff.  What you'll need to do is create a 
hidden field for EVERY member of the session object and then reassemble the 
object in the subsequent script:

my $session = new Session;
$session->{uid} = $q>param('uid');

hope that helps,
Sean

On Friday 17 December 2004 09:08 am, Jonathan Mangin wrote:
> Hi all,
>
> Is it possible to pass objects back to a perl program as hidden variables?
> I tried...
>
> Template:
>      <input type=hidden name=session value=[% session %]>
>
> Subroutine:
>      my $session = $q->param('session');
>      my $uid = $session->param('uid');
>
> which failed miserably. Any help would be greatly appreciated.
>
> Thanks,
> Jon
>
>
> _______________________________________________
> templates mailing list
> templates@xxxxxxxxxxxxxxxx.xxx
> http://lists.template-toolkit.org/mailman/listinfo/templates

        -- 
        Sean Kellogg
2nd Year - University of Washington School of Law
GPSS Senator - Student Bar Association
Editor-at-Large - National ACS Blog [http://www.acsblog.org]
c: 206.498.8207    e: skellogg@x.xxxxxxxxxx.xxx

So, let go
 ...Jump in
  ...Oh well, what you waiting for?
   ...it's all right
    ...'Cause there's beauty in the breakdown

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] Objects as hidden variables?
Jonathan Mangin 17:08 on 17 Dec 2004

Re: [Templates] Objects as hidden variables?
Sean Kellogg 17:16 on 17 Dec 2004

Re: [Templates] Objects as hidden variables?
Jonathan Mangin 17:32 on 17 Dec 2004

Re: [Templates] Objects as hidden variables?
Larry Leszczynski 19:14 on 17 Dec 2004

Re: [Templates] Objects as hidden variables?
Sean Kellogg 19:36 on 17 Dec 2004

Re: [Templates] Objects as hidden variables?
Jonathan Mangin 19:49 on 17 Dec 2004

Re: [Templates] Objects as hidden variables?
Trond Michelsen 00:42 on 18 Dec 2004

Re: [Templates] Objects as hidden variables?
merlyn (Randal L. Schwartz) 03:30 on 18 Dec 2004

RE: [Templates] Objects as hidden variables?
Simon Matthews 12:34 on 18 Dec 2004

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52