You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by Tom Brown <tb...@michiana.org> on 2005/10/28 05:31:32 UTC

Passing variable to another doc

What is a good way to pass a single string variable or list from one 
Rivet doc to another?

Using a hidden form variable, GET/POST and var get, is convoluted to 
me. Declaring a global variable in the sending page doesn't work. 
Placing the variable in a file, then reading the file in the next 
doc, works but seems heavy handed. I suspect that I'm overlooking 
something simple.

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: Passing variable to another doc

Posted by Tom Brown <tb...@michiana.org>.
I looked at the session package docs, and it seems to fit my need.

Tom

At 11:11 PM 10/27/05, Roy Keene wrote:
>Mr. Brown,
>
>         Rivet comes with a "session" package, IIRC.  You'd want to 
> use this module to store information in the session resources 
> provided.  But all it's going to do is write stuff to disk and load it up. :-)
>
>         Roy Keene
>         Planning Systems Inc
>
>On Thu, 27 Oct 2005, Tom Brown wrote:
>
>>What is a good way to pass a single string variable or list from 
>>one Rivet doc to another?
>>
>>Using a hidden form variable, GET/POST and var get, is convoluted 
>>to me. Declaring a global variable in the sending page doesn't 
>>work. Placing the variable in a file, then reading the file in the 
>>next doc, works but seems heavy handed. I suspect that I'm 
>>overlooking something simple.
>>
>>Tom
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
>>For additional commands, e-mail: rivet-dev-help@tcl.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: Passing variable to another doc

Posted by Roy Keene <rk...@psislidell.com>.
Mr. Brown,

 	Rivet comes with a "session" package, IIRC.  You'd want to use 
this module to store information in the session resources provided.  But 
all it's going to do is write stuff to disk and load it up. :-)

 	Roy Keene
 	Planning Systems Inc

On Thu, 27 Oct 2005, Tom Brown wrote:

> What is a good way to pass a single string variable or list from one Rivet 
> doc to another?
>
> Using a hidden form variable, GET/POST and var get, is convoluted to me. 
> Declaring a global variable in the sending page doesn't work. Placing the 
> variable in a file, then reading the file in the next doc, works but seems 
> heavy handed. I suspect that I'm overlooking something simple.
>
> Tom
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
> For additional commands, e-mail: rivet-dev-help@tcl.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: Passing variable to another doc

Posted by "David N. Welton" <da...@dedasys.com>.
[ CC'ed to the mailing list ]

Tom Brown wrote:
>> You could create some "macros" to make things easier, like:
>>
>> proc hidden {key val} {
>>     puts "<input ... name = $key val = $val ....>"
>> }
>>
>> Keep in mind that someone could observe what's happening and substitute
>> their own values for things passed through their browser.
> 
> 
> Must I use <form action="filename.rvt"> for the <input...> tag to pass
> the variables to a document?

It depends on how your page is structured.  You can also create url's
like so:

puts "<a href=\"/foo.rvt?foovar=$foo&othervar=$val\">Click here!</a>"

although it's best to use the http::formatQuery proc to do this cleanly
and safely.

>> Not really.  The web is stateless, and making web apps stateful is a
>> pain in the neck.  You can use a database instead of a flat file - that
>> buys you something in terms of speed and reliability, but the concept is
>> pretty much the same.

> Do I need to save session info so that different browser sessions read
> their own database record and not another's?

I think the session package takes care of things for you via cookies so
that you get the right session, but I haven't used it myself...

-- 
David N. Welton
- http://www.dedasys.com/davidw/

Linux, Open Source Consulting
- http://www.dedasys.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: Passing variable to another doc

Posted by "David N. Welton" <da...@dedasys.com>.
Tom Brown wrote:
> What is a good way to pass a single string variable or list from one
> Rivet doc to another?
> 
> Using a hidden form variable, GET/POST and var get, is convoluted to me.

Welcome to web programming;-)

You could create some "macros" to make things easier, like:

proc hidden {key val} {
    puts "<input ... name = $key val = $val ....>"
}

Keep in mind that someone could observe what's happening and substitute
their own values for things passed through their browser.

> Declaring a global variable in the sending page doesn't work. 

That won't really work because the browser might hit another apache
process the next time around which does not have that global variable.

> Placing
> the variable in a file, then reading the file in the next doc, works but
> seems heavy handed. I suspect that I'm overlooking something simple.

Not really.  The web is stateless, and making web apps stateful is a
pain in the neck.  You can use a database instead of a flat file - that
buys you something in terms of speed and reliability, but the concept is
pretty much the same.

-- 
David N. Welton
- http://www.dedasys.com/davidw/

Linux, Open Source Consulting
- http://www.dedasys.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org