[Zope] Trying to do something tricky (for me, that is)

Andrew Henshaw andrew.henshaw@gtri.gatech.edu
Fri, 3 Mar 2000 15:53:44 -0500


Okay, never mind.  I figured it out.  I needed to use:

 expr="REQUEST.has_key('division')

to determine if the 'division' has been defined.

Also, the passing of multiple variables was obvious - just define a hidden
input field.

Thanks, anyway.



-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
Andrew Henshaw
Sent: Friday, March 03, 2000 2:03 PM
To: zope@zope.org
Subject: [Zope] Trying to do something tricky (for me, that is)


Okay, I'm new to Zope (3 days), but I was having such success with some
simple things that I thought that I could handle something tricky - I've
been working at it for a day now.

What I would like to do is present two selections (Division and Team) that
are populated from an ODBC connection.  I can do the population fine,
normally; but the trick is that I'd like to have the Team selection
dependent upon the Division selection (on the same web page).  I realized
that I couldn't do this on a simge form (or can I?), so I've assigned the
two selections to two forms.  I'm putting the two forms on the same page for
aesthetic (stubborness?) reasons.  Here's the code for the first form:

<form action="index_html" method="get"> Division:
  <select name="division" width=30 value="">
    <dtml-in sqlShowDivisions size=50 start=query_start>
      <option> <dtml-var age_group>
    </dtml-in>
  </select>
  <input type="SUBMIT" value="SUBMIT">
</form>


This part works fine.  When I submit the form, the same page is regenerated
(with the 'division' parameter passed in).
One of my many failed attempts with the second form (which is also in
'index_html') is as follows:

<form action="TeamSchedule" method="get">
  <dtml-var division missing="Undefined"> Team:
  <select name="team" width=30 value="">
     <dtml-in sqlTeamsInDivision size=50 start=query_start>
        <option><dtml-var name>
     </dtml-in>
  </select>
  <input type="SUBMIT" value="SUBMIT">
</form>

my sqlTeamsInDivision has 'division' as its only parameter.

When the user first enters the document, he gets an KeyError on 'division'.
I understand why this is so (the division parameter doesn't exist yet), but
I can't seem to work around it .

I tried changing the sql parameter to divisionname and changing the
<dtml-in> tag to:

<dtml-in expr="sqlTeamsInDivision(divisionname='<dtml-var division
missing>')" size=50 start=query_start>

and the error goes away, but the returned list is just blanks.  How should I
be handling this?

Also, when this form is submitted, it calls TeamSchedule with the 'team'
parameter, but I need to also pass the 'division' parameter.  How do I do
this?

Thanks in advance.


--
Andrew M. Henshaw
Sr. Research Engineer
GTRI Electronics Systems Lab
(404) 894-2508



_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )