[Zope] Re: CheckBoxes, dynamic lists and SQL insert statements

Julian Clark Julian.Clarke@b-online.com.au
Wed, 16 Jul 2003 13:35:34 +0800


Hi list,

Sorry about the messyness of my previous post, I'd forgotten to shift the
email type to plain text.

I've modified the code from before, but Its still not working.

<!-- form 2 (I believe this is ok) -->
<form action="meth_step_2" name="form2">
<table>
  <!--#in dealer_entity_search -->
      <tr>
    <td>
          <input type='checkbox' name='marketinglist:list' checked
value='<!--#var dealer_code -->'></input>
          <!--#var dealer_code --></td>
   <td><!--#var dealer_name --></td>
     </tr>
  <!--#/in --><TR><TD><button type="submit">Add</button></TD></TR>
  </form>
</table>

<!-- meth_step_2 (I think this is ok - but I guess that this is where the
problem lies)  -->
<!--#with sql -->
    <!--#in marketinglist -->
        <!--#call insert_holding_table -->
    <!--#/in -->
<!--#/with -->

When I display <!--#var sequence-item --> within the in statement, the
correct values display, they're just not seeming to make it
to my query.

<!-- insert_holding_table (this works by itself, but perhaps not when called
by a dtml method)   -->
insert into mHoldingTable
(
dealer_code
)
values
(
<dtml-sqlvar sequence-item type="string" >
);


This is the error...
Error Type: Bad Request
Error Value: ['sequence-item']
<!--
Traceback (innermost last):
  File D:\Zope\2-3-3\lib\python\ZPublisher\Publish.py, line 223, in
publish_module
  File D:\Zope\2-3-3\lib\python\ZPublisher\Publish.py, line 187, in publish
  File D:\Zope\2-3-3\lib\python\Zope\__init__.py, line 221, in
zpublisher_exception_hook
    (Object: Traversable)
  File D:\Zope\2-3-3\lib\python\ZPublisher\Publish.py, line 171, in publish
  File D:\Zope\2-3-3\lib\python\ZPublisher\mapply.py, line 160, in mapply
    (Object: meth_step_2)
  File D:\Zope\2-3-3\lib\python\ZPublisher\Publish.py, line 112, in
call_object
    (Object: meth_step_2)
  File D:\Zope\2-3-3\lib\python\OFS\DTMLMethod.py, line 189, in __call__
    (Object: meth_step_2)
  File D:\Zope\2-3-3\lib\python\DocumentTemplate\DT_String.py, line 540, in
__call__
    (Object: meth_step_2)
  File D:\Zope\2-3-3\lib\python\DocumentTemplate\DT_With.py, line 151, in
render
    (Object: sql)
  File D:\Zope\2-3-3\lib\python\DocumentTemplate\DT_In.py, line 719, in
renderwob
    (Object: marketinglist)
  File D:\Zope\2-3-3\lib\python\Shared\DC\ZRDB\DA.py, line 476, in __call__
    (Object: insert_holding_table)
  File D:\Zope\2-3-3\lib\python\Shared\DC\ZRDB\Aqueduct.py, line 150, in
_argdata
    (Object: insert_holding_table)
Bad Request: (see above)
-->

Again, any help would be greatly appreciated.
Thanks.
______________________________________________________

______________________________________________________
Julian Clark
julcla@b-online.com.au
Ph: +61 8 9463 5069
______________________________________________________


Hi all,
I'm feeling rather thick, as I've been reading through some of a similar
question from about 2 years back

( http://mail.zope.org/pipermail/zope/2001-August/097408.html )

and I'm not quite understanding it.

What I am trying to achieve is to pull some date from one table by an SQL
query, and have the results selectable/de-selectable by the form of a
checkbox - to then be dumped into a temporary table.

I'm guessing that it's probably something simple, and I'm just too close to
the code.

This here is my selection via checkbox form.. this seems to pass the
information to my next step ok...
I believe that I have a problem with how I am interpreting this data.

<!-- form 2 -->
<form action="meth_step_2" name="form2">
<table>
  <!--#in dealer_entity_search -->
      <tr>
    <td>
          <input type='checkbox' name='marketinglist:list' checked
value='<!--#var dealer_code -->'></input>
          <!--#var dealer_code --></td>
   <td><!--#var dealer_name --></td>
     </tr>
  <!--#/in --><TR><TD><button type="submit">Add</button></TD></TR>
  </form>
</table>

<!-- meth_step_2 -->
<!--#with sql -->
    <!--#in marketinglist -->
      <!--#let dealer_code=sequence-item -->
        <!--#call insert_holding_table -->
      <!--#/let -->
    <!--#/in -->

<!--#/with -->

<!-- insert_holding_table -->
insert into mHoldingTable
(
dealer_code
)
values
(
<dtml-sqlvar dealer_code type="string" >
);

What I am wanting to appear in the holding table is a whole lot of separate
records, each containing only a dealer_code (which is a 4 digit integer -
text field in the DB though)
I'm using Zope 2.3.3 attempting to inserting into MS Access 2000.

Thanks in advance.
______________________________________________________
______________________________________________________
Julian Clark
julcla@b-online.com.au
Ph: +61 8 9463 5069
______________________________________________________