On Wed, Jul 31, 2002 at 09:20:39PM +0100, Sebastian Rahtz wrote:
> On Wed, Jul 31, 2002 at 05:51:24PM +0100, Matt Sergeant wrote:
> > > Has anyone used this successfully? When I look at the result, it
> > > seems to contain a single string, of the first selection.
> > >
> > > If anyone has a working example I could see, I would be grateful.
> >
> > I think the code was probably cut/paste from the single-select version.
> > I'm guessing it needs fixing somehow.
>
> I had proceeded in my tentative way to reach the same conclusion :-}
>
> do we have any PerForm maestros on the list? do many people use
> it in production? (well, I do, but I have never needed a multi-select
> before).
I tried a quick test of multi-select. I think your problem is that $selected
needs to be an arrayref. See my example below. (appears to work as expected)
(On an unrelated note) ... I use PerForm a bunch and made several 'additions'.
A noteworthy addition is the use of Data::FormValidator. Right now its
'rigged' for my needs but can be cleaned up for generic use. I plan to post it
to the list but havn't got around to it yet (/me tired of webforms).
If your interested or 'brave enough' feel free to ask.
Ed
------- xsp file -------
<?xml version="1.0"?>
<xsp:page
xmlns:xsp="http://apache.org/xsp/core/v1"
xmlns:f="http://axkit.org/NS/xsp/perform/v1" language="Perl">
<xsp:logic>
<![CDATA[
sub load_juice {
my ($ctxt, $sel) = @_;
return [qw(1 2 3)], "one" => 1, "two" => 2, "three" => 3, "four" => 4;
}
]]>
</xsp:logic>
<document>
<section>
<f:form name="noop">
<f:multi-select name="juice"/>
</f:form>
</section>
</document>
</xsp:page>
--------------
Result ->
================
<document><section><form name="noop" action="/xtest.xsp" method="POST"
enctype="multipart/form-data"><input type="hidden" name="__submitting" value="1"/>
<multi_select>
<options><option value="1" selected="selected">one</option><option value="2"
selected="selected">two</option><option value="3"
selected="selected">three</option><option
value="4">four</option></options><name>juice</name></multi_select></form></section></document>
===============
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]