I have a form comprising two selection lists, each supporting multiple
selection. I want the inputs to become parameters to a zsql method. I find
the input works if the user selects at least one item from each list, but
fails with a 'bad object id' message if either list is left unselected. I
have tried providing a default list value, no luck. Any ideas out there?

The form looks like:

<dtml-var standard_html_header>
<p><font face="Arial">Use this form to specify the parameters for your query
<p>All fields are optional
<p>Multiple selection is supported - hold down the CONTROL key</font>
<FORM action="dtSubmitRumour">

<SELECT name="Operators:list" multiple>

 <dtml-in dbRetrieveAllOperators>

<OPTION VALUE='<dtml-var OperatorID>'>
  <dtml-var FullName null="None in particular">

<SELECT name="Classes:list" multiple>

 <dtml-in dbRetrieveAllClasses>

<OPTION VALUE='<dtml-var OperatorClassID>'>
  <dtml-var "FullName + OperatorClass + ' Class'">

<input type="submit" value="Submit" name="B1"></p>


and the zsql method reads:

use thetable
BEGIN transaction INSERT INTO rumours
               VALUES (<dtml-sqlvar Description type=nb optional>)
                   DECLARE @rumourid int
                       SELECT @rumourid = MAX(rumourid)
                     FROM rumours

<dtml-if Operators>
<dtml-in Operators>
                           INTO roperators(rumourid, OperatorID)
VALUES (@rumourid, <dtml-sqlvar sequence-item type=int>)
<dtml-if Classes>
<dtml-in Classes>
                           INTO rclasses(rumourid, ClassID)
VALUES (@rumourid, <dtml-sqlvar sequence-item type=int>)

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to