On Sat, Aug 05, 2006 at 08:27:25PM -0300, Jorge Godoy wrote: > Paul M Foster <paulf@xxxxxxxxxxxxxxxxx> writes: > > Here's an example: The user wants to enter a bill (accounts payable) > > into the system. He first has to pick a vendor. Normally, this would > > entail a PHP page that generates a PostgreSQL query. The user would > > then get a second page with various vendor information (like number > > of due days for that vendor), and various other payable info. > > But wouldn't it be nice to have vendor information filled in > > on the original page, directly after the user picks a vendor? > > Theoretically, AJAX might allow something like this. But from what I > > can see, it would require PostgreSQL bindings in Javascript, and > > some way to pass the data back so that PHP could use it. > > I'd do it the reverse: Javascript would call a PHP-enabled URL, PHP > would get the data, return to JS, JS would then populate the form. > > This way all your logic is contained within PG and PHP. JS would only > be used to manipulate the interface. I'm not using php, but the idea behind it is similar. I use postgresql, zope and scriptaculous. The autocompleter calls a ZSQL method, which calls a stored procedure and returns data to the ajax part of the website. If you give a look in google for scriptaculous examples, you'll find a lot of them for php working in a similar way: they call a php page which returns the information for the autocompleter. In all the examples I've seen there's no input sanitysing (they are all toy examples) but it is not difficult to implement it.