Solved

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

Posted on 2012-04-12
2
628 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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…
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

839 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