Valerio Gionco <[EMAIL PROTECTED]> writes:

> > > 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

> > 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...

> > 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...

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

I don't like seperators.  It strikes me as being too arbitrary, and an
inelegant solution, as well as something 'external' to the Tcl
language.

> Have you a better idea?

Well, we could do something like this:

if there are multiple variable values, create a list with sub-lists,
so that you have something like:

{this is comment 1} {this is comment 2} {this is comment 3} 

that seems more tcl-ish to me.  I suppose it might still be difficult
to tell exactly what you have received.

Hrm... brainstorming, there are some more radical solutions.  Place
multiple variables in a different array... or even create a variable
command:

[ VARS key x ] for example...

[ VARS num x ] tells you that there are 3 values.

But that's definitely a more radical solution, and something that I'm
not sure I want to implement without discussion.

What do you think?

-- 
David N. Welton
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/
         Work: http://www.innominate.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to