Solved

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

Posted on 2012-04-12
2
623 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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 …
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now