Forums/How Do I ... ?

Use queries on custom database and display the result

mike wenger
posted this on September 22, 2011, 19:58

I want to provide listboxes with values from database, user picks correct value and query the custom database and display the results

 

Comments

User photo
Michael Slater
Webvanta

Mike,

You can use the w:kb:item:each iterator to create the elements for an HTML select. Assuming you want to display the database contents without doing a form submit, then you need to write JavaScript to detect that a change has occurred on the select element, make an ajax request for a page that shows the contents of the database item, and write that contents to the page.

The page that you request via ajax is just a Webvanta "item" page, using a template that is essentially blank, since you just want the core content and not any of the page wrapper.

The Webvanta-specific parts of this are all simple -- it is the JavaScript bits that are a little more complicated. Just what this code looks like depends on whether or not you are using jQuery, and if so, which version.

If you wanted us to set this all up for you, it would be a 2-4 hour project depending on just what you need.

October 2, 2011, 15:14