You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-dev@httpd.apache.org by Bojan Smojver <bo...@rexursive.com> on 2004/05/27 06:16:13 UTC

Multiple select

I'm probably missing something in the documentation to this effect...
Anyhow, if one uses <select multiple="multiple"> tag, how are the
multiple values retrieved using libapreq2? When calling apreq_param(), I
only get one (the first) back...

BTW, in the Doxygen docs, the apreq_params() function is described as:
"Returns all parameters for the requested key, NULL if none found. The
key is case-insensitive." I'm guessing the initial intention of this
function was something to the effect I described above (except that an
array would have to be returned, not a table), but the docs haven't been
adjusted. In reality, this function returns all parameters from the
query string and the body, and it doesn't have "key" parameter at all
(only pool and request).

-- 
Bojan


Re: Multiple select

Posted by Bojan Smojver <bo...@rexursive.com>.
There is also apreq_params_as_string() macro. I think as is, it would
probably not work.

On Thu, 2004-05-27 at 23:28, Joe Schaefer wrote:
> Bojan Smojver <bo...@rexursive.com> writes:
> 
> > My guess is that the whole thing is actually done using apr_table_do()
> > with a desired key (or keys) and on all parameters returned by
> > apreq_params(). Is that the correct approach()? 
> 
> Yes- that's how we do it in Apache::Request::param.
> 
> > It looks like the docs are a little bit confusing on the whole
> > issue...
> 
> Oops, you're absolutely right.  IIRC the idea was to keep a 
> common api for apreq_param* and apreq_upload*; unfortunately 
> the docs fell out of sync.  I've been going through the header files
> this week trying to document the rest of the API, I'll fix the
> broken apreq_params* docs as well.
> 
> Thanks!
-- 
Bojan


Re: Multiple select

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Bojan Smojver <bo...@rexursive.com> writes:

> My guess is that the whole thing is actually done using apr_table_do()
> with a desired key (or keys) and on all parameters returned by
> apreq_params(). Is that the correct approach()? 

Yes- that's how we do it in Apache::Request::param.

> It looks like the docs are a little bit confusing on the whole
> issue...

Oops, you're absolutely right.  IIRC the idea was to keep a 
common api for apreq_param* and apreq_upload*; unfortunately 
the docs fell out of sync.  I've been going through the header files
this week trying to document the rest of the API, I'll fix the
broken apreq_params* docs as well.

Thanks!
-- 
Joe Schaefer


Re: Multiple select

Posted by Bojan Smojver <bo...@rexursive.com>.
My guess is that the whole thing is actually done using apr_table_do()
with a desired key (or keys) and on all parameters returned by
apreq_params(). Is that the correct approach()? It looks like the docs
are a little bit confusing on the whole issue...

-- 
Bojan


Re: Multiple select

Posted by Bojan Smojver <bo...@rexursive.com>.
Just to clarify... This is similar to getParameter() v. 
getParameterValues() methods from the Java Servlet API (interface
ServletRequest), for all Java speaking people.

On Thu, 2004-05-27 at 14:16, Bojan Smojver wrote:
> I'm probably missing something in the documentation to this effect...
> Anyhow, if one uses <select multiple="multiple"> tag, how are the
> multiple values retrieved using libapreq2? When calling apreq_param(), I
> only get one (the first) back...
> 
> BTW, in the Doxygen docs, the apreq_params() function is described as:
> "Returns all parameters for the requested key, NULL if none found. The
> key is case-insensitive." I'm guessing the initial intention of this
> function was something to the effect I described above (except that an
> array would have to be returned, not a table), but the docs haven't been
> adjusted. In reality, this function returns all parameters from the
> query string and the body, and it doesn't have "key" parameter at all
> (only pool and request).
-- 
Bojan


Re: Multiple select

Posted by Bojan Smojver <bo...@rexursive.com>.
To confuse me even more, there is a macro apreq_params_as_string() that
is supposed to merge all of those into a comma separated string. It is
defined as:

apreq_join(pool,", ",apreq_params(req,pool,key),mode)

Like that, it probably wouldn't even pass the compilation - it has an
extra argument (apreq_params has only two: pool and req) and the
arguments are not in the correct order (pool should go first).

I must be missing something...

On Thu, 2004-05-27 at 14:16, Bojan Smojver wrote:
> I'm probably missing something in the documentation to this effect...
> Anyhow, if one uses <select multiple="multiple"> tag, how are the
> multiple values retrieved using libapreq2? When calling apreq_param(), I
> only get one (the first) back...
> 
> BTW, in the Doxygen docs, the apreq_params() function is described as:
> "Returns all parameters for the requested key, NULL if none found. The
> key is case-insensitive." I'm guessing the initial intention of this
> function was something to the effect I described above (except that an
> array would have to be returned, not a table), but the docs haven't been
> adjusted. In reality, this function returns all parameters from the
> query string and the body, and it doesn't have "key" parameter at all
> (only pool and request).
-- 
Bojan