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

Posted on 2006-05-04
Last Modified: 2013-12-27
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">

Question by:ISECLABS
    1 Comment
    LVL 10

    Accepted 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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Preface: This article is part of a series focused on cross platform mobile app development (specifically Android and iOS) using the Alloy framework and Titanium Studio made by Appcelerator ( This article presumes a wor…
    You should read OS supplied guidelines before developing. I can't stress that enough. The guidelines will help you understand the reasons mobile app developers do what they do.  Apple is very particular when they review appstore submissions.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    737 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

    19 Experts available now in Live!

    Get 1:1 Help Now