Re: select multiple

2003-07-10 Thread Wiggins d'Anconia
Dennis Stout wrote:
ARHG.

I want to stay as far away from use CGI; as possible =/

*sigh*

mod_perl and the methods available in the apache request object shuold beable
to replace CGI.pm entirely, especially when you have a highly customized
RequestHandler :/
Guess I'll see what happens, since I need cookie headers to work AND now
multiple values for one param.
Probably best to try and see. Setup a simple handler that calls $r->args 
 in list context and then step through the elements and see how they 
are arranged. I poked around in the 1.0 docs but wasn't able to come up 
with anything concrete, you might also mention which version of mod_perl 
you are dealing with

http://danconia.org



Re: select multiple

2003-07-10 Thread Dennis Stout
> >mod_perl and the methods available in the apache request object shuold
beable
> >to replace CGI.pm entirely, especially when you have a highly customized
> >RequestHandler :/
> >
> >Guess I'll see what happens, since I need cookie headers to work AND now
> >multiple values for one param.
>
> Have you looked at Apache::Request?

Reading documentation.. and it looks like $r->param is what I need :)  Thanks!

--- perldoc Apache::Request ---

param

Get or set request parameters (using case-insensitive
keys) by mimicing the OO interface of "CGI::param".
Unlike the CGI.pm version, Apache::Request's param
method is very fast- it's now quicker than even
mod_perl's native Apache->args method.  However,
CGI.pm's "-attr => $val" type arguments are not sup-
ported.

# similar to CGI.pm

my $value = $apr->param('foo');
my @values = $apr->param('foo');
my @params = $apr->param;

# the following differ slightly from CGI.pm

# assigns multiple values to 'foo'
$apr->param('foo' => [qw(one two three)]);

# returns ref to underlying apache table object
my $table = $apr->param; # identical to $apr->parms - see below

parms

Get or set the underlying apache parameter table of
the Apache::Request object.  When invoked without
arguments, "parms" returns a reference to an
Apache::Table object that is tied to the
Apache::Request object's parameter table.  If called
with an Apache::Table reference as as argument, the
Apache::Request object's parameter table is replaced
by the argument's table.

# $apache_table references an Apache::Table object
$apr->parms($apache_table); # sets $apr's parameter table

# returns ref to Apache::Table object provided by $apache_table
my $table = $apr->parms;




Re: select multiple

2003-07-10 Thread Dennis Stout
ARHG.

I want to stay as far away from use CGI; as possible =/

*sigh*

mod_perl and the methods available in the apache request object shuold beable
to replace CGI.pm entirely, especially when you have a highly customized
RequestHandler :/

Guess I'll see what happens, since I need cookie headers to work AND now
multiple values for one param.

S.T.O.U.T. = Synthetic Technician Optimized for Ultimate Troublshooting
- Original Message - 
From: "Chris Faust" <[EMAIL PROTECTED]>
To: "Dennis Stout" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, July 10, 2003 16 30
Subject: Re: select multiple


> CGI.pm does the trick for me, the multi values are seperated by \0
>
> < select name="yadda" multi>
> yadda1
> yadda2
> yadda3
> 
> 
>
> my $CGI = new CGI();
>  %form_data = $CGI->Vars;
>
> @options = split("\0",$form_data{'yadda'});
>
> $options[0] = yadda1, $options[1] = yadda2  etc .
>
> Not usable live code obviously, but you should see the idea...
>
> -Chris
> - Original Message - 
> From: "Dennis Stout" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Thursday, July 10, 2003 4:52 PM
> Subject: Re: select multiple
>
>
> >
> > Interesting.
> >
> > So in mod_perl, I would use $r->args{__what__} to get to it?  Heh.
> >
> > I'll email the mod_perl list..
> >
> > Dennis
> >
>
>



Re: select multiple

2003-07-10 Thread Chris Faust
CGI.pm does the trick for me, the multi values are seperated by \0

< select name="yadda" multi>
yadda1
yadda2
yadda3



my $CGI = new CGI();
 %form_data = $CGI->Vars;

@options = split("\0",$form_data{'yadda'});

$options[0] = yadda1, $options[1] = yadda2  etc .

Not usable live code obviously, but you should see the idea...

-Chris
- Original Message - 
From: "Dennis Stout" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Thursday, July 10, 2003 4:52 PM
Subject: Re: select multiple


>
> Interesting.
>
> So in mod_perl, I would use $r->args{__what__} to get to it?  Heh.
>
> I'll email the mod_perl list..
>
> Dennis
>




Fw: select multiple

2003-07-10 Thread Dennis Stout
This is the original email I sent out, regarding my multiple selects...

S.T.O.U.T. = Synthetic Technician Optimized for Ultimate Troublshooting
- Original Message - 
From: "Dennis Stout" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 10, 2003 11 39
Subject: select multiple


> Beginners-CGI;
>
> If I have a form with a lot of values (such as Tech ID, Tech Name, Tech
> Queues..) and one of the fields is a select multiple, with a varied amount
of
> options selected, how are those values sent to the cgi script?
>
> Is it something like ?queue=lvl1,lvl2,admin,sysad&foo=bar or what?
>
> Thanks
>
> Dennis
>
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



Re: select multiple

2003-07-10 Thread Dennis Stout
> Because there is no way to create a delimiter that the potential data
doesn't contain, the browser doesn't have the option to choose an arbitrary
delimiter like a comma, or the like.  So (though I can't speak for all
browsers most will do the same) each value is passed with the same key, so
your string ends up like:
>
> ?queue=lvl1&queue=lvl2&queue=admin&queue=sysad&foo=bar
>
> This punts the problem to the server side (or whatever does the query string
parsing) so there are multiple ways to handle it, build a complex data
structure that stores an array reference for any multi-valued keys, store the
keys with some known delimiter (aka cgi-lib.pl used to use the null character
\0).  So it depends on your request parser, some provide multiple manners (I
think the standard CGI does). Have a look at the respective docs for how your
parser handles it, unless you are writing a parser...but then why do that with
so many good freely available ones?

Interesting.

So in mod_perl, I would use $r->args{__what__} to get to it?  Heh.

I'll email the mod_perl list..

Dennis



Re: libapreq and select multiple?

2000-05-03 Thread Doug MacEachern

On Thu, 27 Apr 2000, Jim Winstead wrote:

> On Apr 27, Jim Winstead wrote:
> > Is it just me, or does libapreq not handle the response from  > multiple> correctly? It appears to only make one of the values
> > accessible.
> > 
> > From what I can tell, this appears to go all the way down to the
> > Apache::Table implementation, where the underlying Apache data
> > structure does not quite have the perl semantics of no duplicate
> > keys.
> > 
> > My ideal would be for $apr->param("selectmultiplename") to return
> > an array ref of the values. But I don't really have much of a clue
> > of where to start to implement this.
> > 
> > Thoughts?
> 
> Of course, $apr->param("selectmultiplename") returns an array of
> the values in an array context.
> 
> Subtle. :)

i think those semantics were borrowed from CGI->param.  as an alternative,
you can use $apr->parms, which is an Apache::Table object.




Re: libapreq and select multiple?

2000-04-27 Thread Jim Winstead

On Apr 27, Jim Winstead wrote:
> Is it just me, or does libapreq not handle the response from  multiple> correctly? It appears to only make one of the values
> accessible.
> 
> From what I can tell, this appears to go all the way down to the
> Apache::Table implementation, where the underlying Apache data
> structure does not quite have the perl semantics of no duplicate
> keys.
> 
> My ideal would be for $apr->param("selectmultiplename") to return
> an array ref of the values. But I don't really have much of a clue
> of where to start to implement this.
> 
> Thoughts?

Of course, $apr->param("selectmultiplename") returns an array of
the values in an array context.

Subtle. :)

Jim



libapreq and select multiple?

2000-04-27 Thread Jim Winstead

Is it just me, or does libapreq not handle the response from  correctly? It appears to only make one of the values
accessible.

>From what I can tell, this appears to go all the way down to the
Apache::Table implementation, where the underlying Apache data
structure does not quite have the perl semantics of no duplicate
keys.

My ideal would be for $apr->param("selectmultiplename") to return
an array ref of the values. But I don't really have much of a clue
of where to start to implement this.

Thoughts?

Jim