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

x
  • 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:

<SCRIPT LANGUAGE="JScript" >
<!--

<%
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")%>")
            <%
            Rsset1.movenext
            If Not Rsset1.eof then response.write ","  Else Response.write "),"
            Loop
      Else%>null,
      <%End IF
      Rsset1.close
RssetGroup.MoveNext
Loop
Else%>
groupcodes = new Array(
      null,

<%End IF
RssetGroup.Close
%>null);

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];
}
j++;
}
// select first item (prompt) for sub list
selectCtrl.options[0].selected = true;
   }
}

//<!-- done hiding -->
</script>


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>
</select>

It will generate the following dropdown

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

0
ISECLABS
Asked:
ISECLABS
1 Solution
 
sakuya_suCommented:
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
0

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