Filling in forms and searching for data
Hi all, Just wondering about a couple of issues. I have a form that contains a bunch of blanks. If I fill in that form and click "Add" the entry is added to my PostgreSQL database. If I have existing data in the form and click "Update" the record in my DB is updated. I'm trying to come up with a good Search mechanism. So far this is what I have: If I fill out part of the form and click "Search", I get a list of all matching records returned to me in a nice table. the first column of the table has a radio button and there is an "I Choose You..." button at the bottom of the list. I would like to take the record that the user indicated through use of the radio button and place it back in my Original form. I have come up with two possibilities for this and was wondering which might be the better choice. Possibility 1: I can build a series of lists for each column returned by the query, pass that list back to the originating form, index that list based on the value of the index of my radio button and fill in the blanks. (It actually works quite well) Possibility 2: I can pass back the radio button index to my form, and re-run the SQLQuery then select the appropriate row based on the index in fill in the blanks (I haven't tried this yet) For some reason I like the first better than the second, though something tells me I am needlessly sucking RAM to build a bunch of lists for which I only need one item. It seems that going back to disk for the second query is equally bad. Does anyone have a better suggestion? -- Stand Fast, tjg. Chief Technology Officer tjg@exceptionalminds.com Red Hat Certified Engineer www.exceptionalminds.com Avalon Technology Group, Inc. (503) 246-3630
>>>>>>EXCEPTIONAL MINDS, INNOVATIVE PRODUCTS<<<<<<<<<<<<
The way I do it: -The form is keyed on a unique id - I load it with Form-Name?id=Unique-ID URL -there are actually 2 frames I use for loading the main form and 2 frames I use from displaying lists of records so I can have 2 different records and two different lists active at once.(and some other frames for special uses) -The search returns a list with only a few pertinent columns - one of those columns is the id , 2 of the columns are hrefs displaying W1 and W2, the remaining columns are data that help narrow down what record is needed -Clicking on W1 or W2 loads the form with the desired record into the appropriate frame. The active frames are resized to reveal the appropriate data. (There are also links across the top to resize all the active frames to show you any particular frame desired on demand) -the SQL for querying an an individual record takes a negligible amount of time (< second) - an alternative to reloading the form (if it has a lot of javascript or large select statements) is to call a form to load in a new window that is composed entirely of javascript that updates the fields in the appropriate record form and then closes itself __________________________________________________________________ Jim Sanford . Database/Web Engineer / \ / Accelerated Technology, Inc. / / 720 Oak Circle Drive East / / \ Mobile, AL 36609 / / \ Voice: 334-661-5770 fax: 334-661-5788 / \ E-Mail: jsanford@atinucleus.com Web: http://www.atinucleus.com Source Code, No Royalties, Any CPU...It just make sense ! __________________________________________________________________ ----- Original Message ----- From: Timothy Grant <tjg@avalongroup.net> To: Zope Folk <zope@zope.org> Sent: Tuesday, December 28, 1999 5:35 PM Subject: [Zope] Filling in forms and searching for data Hi all, Just wondering about a couple of issues. I have a form that contains a bunch of blanks. If I fill in that form and click "Add" the entry is added to my PostgreSQL database. If I have existing data in the form and click "Update" the record in my DB is updated. I'm trying to come up with a good Search mechanism. So far this is what I have: If I fill out part of the form and click "Search", I get a list of all matching records returned to me in a nice table. the first column of the table has a radio button and there is an "I Choose You..." button at the bottom of the list. I would like to take the record that the user indicated through use of the radio button and place it back in my Original form. I have come up with two possibilities for this and was wondering which might be the better choice. Possibility 1: I can build a series of lists for each column returned by the query, pass that list back to the originating form, index that list based on the value of the index of my radio button and fill in the blanks. (It actually works quite well) Possibility 2: I can pass back the radio button index to my form, and re-run the SQLQuery then select the appropriate row based on the index in fill in the blanks (I haven't tried this yet) For some reason I like the first better than the second, though something tells me I am needlessly sucking RAM to build a bunch of lists for which I only need one item. It seems that going back to disk for the second query is equally bad. Does anyone have a better suggestion? -- Stand Fast, tjg. Chief Technology Officer tjg@exceptionalminds.com Red Hat Certified Engineer www.exceptionalminds.com Avalon Technology Group, Inc. (503) 246-3630
>>>>>>EXCEPTIONAL MINDS, INNOVATIVE PRODUCTS<<<<<<<<<<<<
_______________________________________________ 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 )
participants (2)
-
Jim Sanford -
Timothy Grant