Solved

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

Posted on 2012-04-12
2
624 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

867 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