ISECLABS
asked on
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("Gro up_ID")
Rsset1.Open strSQL1, objConn
If Not Rsset1.EOF Then%>
new Array(
<%Do until Rsset1.Eof%>
new Array("<%=Rsset1("ICD9CM_C ODE") & "-" & 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(select Ctrl, 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].valu e = itemArray[i][1];
}
j++;
}
// select first item (prompt) for sub list
selectCtrl.options[0].sele cted = true;
}
}
//<!-- done hiding -->
</script>
the above script called from following dropdown.
<select name="Code_Group" id="Code_Group" size="1" onChange="fillSelectFromAr ray(this.f orm.ICD9CM _CODE, ((this.selectedIndex == -1) ? null : groupcodes[this.selectedIn dex-1]));" >
<OPTION VALUE="-1">--Group--</opti on>
<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>
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("Gro
Rsset1.Open strSQL1, objConn
If Not Rsset1.EOF Then%>
new Array(
<%Do until Rsset1.Eof%>
new Array("<%=Rsset1("ICD9CM_C
<%
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(select
var i, j;
var prompt;
// empty existing items
for (i = selectCtrl.options.length;
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].valu
}
j++;
}
// select first item (prompt) for sub list
selectCtrl.options[0].sele
}
}
//<!-- done hiding -->
</script>
the above script called from following dropdown.
<select name="Code_Group" id="Code_Group" size="1" onChange="fillSelectFromAr
<OPTION VALUE="-1">--Group--</opti
<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>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.