"David N. Welton" wrote:
Valerio Gionco <[EMAIL PROTECTED]> writes:

> We are trying to port a big CGI application written in TCL to mod_dtcl.

Cool!

> In some cases, the application calls a CGI setting the same variable
> to more than a value, like in this example (for a GET):

> http://valerio.private/valerio/test.tcl?x=v1&x=v2&x=v3

> Internally our code parsed the URL making something equivalent to

> set $x "v1|||v2|||v3"

> using "|||" as a separator. We patched the source code of mod_dtcl
> to comply with this format, and I think something similar
> (eventually more flexible) should be included in the module.
 
 

[...patch...]
 

This results in one big long list without sub-lists.  If you don't do
the concat, and instead try and use TCL_APPEND_VALUE and
TCL_LIST_ELEMENT as flags to the setvar, you get sublists in your
list, which print like "blah blah {foo bar}", and that doesn't look
very good...

I have committed the above change to CVS and will roll a new release
soon with it.

Does that do more or less what you need?

Yes, more or less. But this implementation is, again, a source of trouble
if the variables contain spaces. Look at this HTML form:

<FORM method="GET" action="test.tcl">
<P>Multiple field:<BR>
Comment 1: <INPUT name="x" type="checkbox" value="this is comment 1">
Comment 2: <INPUT name="x" type="checkbox" value="this is comment 2">
Comment 3: <INPUT name="x" type="checkbox" value="this is comment 3">
<INPUT type="submit" value="Submit"><INPUT type="reset" value="Reset">
</FORM>

If I check the first and third box, for instance,
when the Submit button is pressed, and test.tcl is called...

#-----test.tcl-----------

headers type text/html

puts "Variable x: $::request::VARS(x)<BR>"

set lista $::request::VARS(x)
set n [llength $lista]
puts "x contains $n elements.<BR>"
#----------------------
 

...the result is something like:

this is comment 1 this is comment 3
x contains 8 elements

...which is not what I want. Here I cannot tell how many values
x is assigned to (keep in mind that only checked boxes are passed from
the browser).

A good implementation (for us, of course..:)) could make use of
separators, perhaps configurable in a Tcl variable or through
an Apache directive.

Have you a better idea?
 

Valerio Gionco
-- 
****************************************************************************
            "Life's not fair, but the root password helps."
 

 



Reply via email to