Solved

Quickbase API Quuestion. Need to populate 2 drop downs from separate tables

Posted on 2012-04-12
2
631 Views
Last Modified: 2016-11-17
I have a web form which connects to a Quickbase application db.

The db has 2 tables with fields
Table: Region
Field: Region (which is populated)
Table:Site
Field: Site (which is also poplulated)

I need to be able to display the field selections available within QB on the drop down field within the html form field.

I am able to display the Regions field (named _fid_6 within QB)
However I can't figure out how to get the Site field from the Site table to display. Within the Site table it's id is also _fid_6.
0
Comment
Question by:js1138
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 37842322
each time you change the first one, you need to clear the site dropdown and fill it with value where Site._fid_6 = Region._fid_6

generaly we use the onchange attribute :

<select id="RegionDropdown" onchange="updateSiteDropdown([b]this.value[/b]);">

Open in new window


the value of each option is the ID of the Region : _fid_6

you've a javascript function to :

function updateSiteDropdown(_fid_6) {
       var SiteDropdown = document.getElementById("SiteDropdown");

       // clear it the Site Dropdown:
       SiteDropdown.options.length = 0
  
       // getOptionsWithAjaxCall; // http://www.w3schools.com/ajax/ajax_database.asp
       var options = Sites[_fid_6]; // Site is an object like this {    "1":[{v:10,t:"Site11"},{v:11,t:"Site12"},{v:12,t:"Site13"}],  "2":[{v:14,t:"Site2"}]   } where 1, 2 are _fid_6

       var o = new Option;
       var x;
       for(i=0;i<options.length;i++) {
             o.text = options[i].t;
             o.value = options[i].v;
             SiteDropdown.options[SiteDropdown.options.length] = o;
       }
}

Open in new window

0
 

Expert Comment

by:Jess H
ID: 41891981
Thought this may be helpful to others who have questions about the QuickBase API.  QuickBase updated their reference page to include a more detailed guide.  See it here: http://help.quickbase.com/api-guide/index.html
1

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question