[Zope] question about forms and zsql

Robert Hood, Ph.D. rhood@mtsu.edu
Tue, 12 Feb 2002 10:22:23 -0600


So far I'm enjoying zope.  I've rewritten several sites using it, and think 
it will make my work more efficient.  One of my older sites stores material 
in database.  I'm probably going to put everything in zope eventually, but 
for now I just want to improve the search on a (small MS Access) database.

So I now use zope to communicate with the database, and have created a form 
to search it, though at the moment my form is limited to exact 
matches--e.g., if you search on "Environmental Ethics" you'll get a result, 
but not if you search "Ethics."

In sql you can use LIKE %name% to let people search more flexibly.

So how do I pass the %name% from the form to the method?  Do I make the 
change to the form, or to the zsql method?

if the form has a field like:
<input type="text" name="CourseName" size=20>

and the zsql method is:
SELECT * FROM Courses
WHERE
(CourseName LIKE <dtml-sqlvar CourseName type=string> OR
SemesterTaught LIKE <dtml-sqlvar SemesterTaught type=string> OR
CourseType LIKE <dtml-sqlvar CourseType type=string> )

btw, the site is:
http://appliedphilosophy.mtsu.edu/syllabusproject/index.html

thanks,

Robert