I am trying to create a form that will dynamically fill a select list from information retrieved as a recordset from a sql database. I seem to retrieve the information fine. The problem is loading it into the select statement. I am using a vbscript to get the recordset and loop through it and than passing the datavalue that I want listed in the select list to a javascript to add it the select. Where I am having problems with is when I pass the variable to the Javascript it tells me type mismatch on loadselect. Here is the pertinent code. Any help would be greatly appreciated.
Code:<script type="text/javascript"> Function LoadSelect(team) { msgbox "in LoadSelect"; oSelect = document.getElementById("Ugroups"); objNewOption = document.createElement("OPTION"); objNewOption.Value = team.value; objNewOption.Text = team.value; oSelect.options.Add(objNewOption); } </script> <script type="text/vbscript"> Function Load(document) Dim oConn, oRS, strConn Set oRS = CreateObject("ADODB.Recordset") Set oConn = CreateObject("ADODB.Connection") strConn = "Driver={SQL Native ..... oConn.Open strConn strSQL = "select ...... set oRS = oConn.Execute(strSQL) Do while not oRS.eof dim grpstr grpstr = "" msgbox Trim(oRS.Fields("gname")) grpstr = Trim(oRS.Fields("gname")) LoadSelect grpstr oRS.movenext loop oConn.Close set oConn = nothing end Function </script> <select id="Ugroups" size="1" style="background-color:#ffff99" name="Ugroups" > </select>


Reply With Quote

Bookmarks