[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

Javascript/Jscript for PDA to generate dynamic dropdown from ms-sql db and selected groupu.

Hello Expert,

I'm using the javascript/Jscript to generate the dynamic dropdown based on MS_sql server table and selected group on the first dropdown  (Group dropdown). It's working fine on the desktop but it doesn't display anything on the PDA, any help would be greatly appreciate.

Here is my code sample:


StrSQLGroup="Select Group_ID from Hr_Codegroup where Group_ID<>1 Order By Group_ID"
RssetGroup.Open StrSQLGroup, objConn
If Not RssetGroup.EOF Then%>
      groupcodes = new Array(
      <%Do until RssetGroup.Eof
      strSQL1 ="SELECT ICD9CM_CODE, SHORT_DESCRIPTION, Favorites,Group_ID From HR_ICD9CM_BASE WHERE Favorites = 1 And  Group_ID="&RssetGroup("Group_ID")
      Rsset1.Open strSQL1, objConn
      If Not Rsset1.EOF Then%>
            new Array(
            <%Do until Rsset1.Eof%>
                  new Array("<%=Rsset1("ICD9CM_CODE") & "-" & Rsset1("SHORT_DESCRIPTION")%>", "<%=Rsset1("ICD9CM_CODE") & "-" & Rsset1("SHORT_DESCRIPTION")%>")
            If Not Rsset1.eof then response.write ","  Else Response.write "),"
      <%End IF
groupcodes = new Array(

<%End IF

function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) {
var i, j;
var prompt;

// empty existing items
for (i = selectCtrl.options.length; i >= 0; i--) {
selectCtrl.options[i] = null;
prompt = (itemArray != null) ? goodPrompt : badPrompt;
if (prompt == null) {
j = 0;
else {
selectCtrl.options[0] = new Option(prompt);
j = 1;
if (itemArray != null) {
// add new items
for (i = 0; i < itemArray.length; i++) {
selectCtrl.options[j] = new Option(itemArray[i][0]);
if (itemArray[i][1] != null) {
selectCtrl.options[j].value = itemArray[i][1];
// select first item (prompt) for sub list
selectCtrl.options[0].selected = true;

//<!-- done hiding -->

the above script called from following dropdown.

<select name="Code_Group" id="Code_Group" size="1" onChange="fillSelectFromArray(this.form.ICD9CM_CODE, ((this.selectedIndex == -1) ? null : groupcodes[this.selectedIndex-1]));">
<OPTION VALUE="-1">--Group--</option>
<Option value="2'">group2</option>
<Option value="3'">group3</option>

It will generate the following dropdown

<SELECT id="ICD9CM_CODE" size="2" name="ICD9CM_CODE">

1 Solution
Javascript capability is very limited on a Pocket PC, to view them you will need a 3rd party browser like NetFront, and even then some functions are not supported

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now