Hi All,
This is similar to another thread i posted but it's taking it a step further.
I first put together the code below on a form with other fields,
which works to select a MatNum from a list then it gives any matching
descriptions to that matnum. I pick a MatNum from list, then I get all
descriptions in a list.
Changed above to below because what I would like to do is....Code:<td>Mat Num:</td> <td> <select class="clrBg" size="1" name="MatNum" onChange="document.form.action='<%=request.servervariables("Script_Name")%>';document.form.submit();"> <% strSQL = "Select Distinct MaterialNum from tblListMaster Order by MaterialNum" set rs = conn.execute(strSQL) do while not rs.eof %> <option value="<%=rs("MaterialNum")%>" <%if rs("MaterialNum") = strMatNum then response.Write(" selected=""selected""") end if%>><%=rs("MaterialNum")%></option> <% rs.movenext loop %> </select> </td> </tr> <tr> <td>Test Item Desc.:</td> <td> <select size="1" name="ItemDescription"> <% strSQL = "Select Distinct MaterialNum,ItemDesc from tblListMaster where MaterialNum='" & strMatNum & "' Order by ItemDesc" set rs = conn.execute(strSQL) do while not rs.eof %> <option value="<%=checkOutTxt(rs("ItemDesc"))%>" <%if rs("ItemDesc") = strItemDesc then response.Write(" selected=""selected""") end if%>><%=rs("ItemDesc")%></option> <% rs.movenext loop %> </select> </td> </tr>
1) make MatNum a textbox with option to Pick from
list...so if you don't want to type in a textbox you can select from list. (see function below does this)
2) if the textbox matnum is chosen then you should get a textbox for description
3) if you pick from the matnum list then you should get the description list.
I tried the below and I get the textbox and text reading Pick from list, so
I pick from list but it doesn't update my description list......
Here is the code:
with load...Code:objectType = 0; function changeFormObject() { var object_span = ""; var change_span = ""; if (objectType != 1) { object_span += ("<input type='text' name='MatNum' />"); change_span += ("Pick from List!"); objectType = 1; } else { object_span += ("<select name='MatNum'>"); object_span += ("<option value=''> - SELECT - </option>"); //for (o=1;o<=10;o++) { <% strSQL = "Select Distinct MaterialNum from tblListMaster Order by MaterialNum" set rs = conn.execute(strSQL) Do while not rs.eof response.write (vbcrlf&"object_span += ""<option value='" & rs("MaterialNum") & "'>" & rs("MaterialNum") & "</option>""") rs.movenext Loop %> //object_span += ("<option value='" + o + "'>ITEM " + o + "</option>"); //} object_span += ("</select>"); change_span += ("change to textbox."); objectType = 2; } document.getElementById("object_span").innerHTML = object_span; document.getElementById("change_span").innerHTML = change_span; }
in my form:Code:<BODY class="clrBg" onload="changeFormObject()">
Any help or suggestions is greatly appreciated. Thanks!Code:<TR> <TD>Mat Num:</TD><TD><span id="object_span"></span> <span id="change_span" onclick="changeFormObject()" onmouseover="this.style.cursor='pointer';"></span> </TD> </TR> <tr> <td>Test Item Desc.:</td> <td> <select size="1" name="ItemDescription"> <% strSQL = "Select Distinct MaterialNum,ItemDesc from tblListMaster where MaterialNum='" & strMatNum & "' Order by ItemDesc" set rs = conn.execute(strSQL) do while not rs.eof %> <option value="<%=checkOutTxt(rs("ItemDesc"))%>" <%if rs("ItemDesc") = strItemDesc then response.Write(" selected=""selected""") end if%>><%=rs("ItemDesc")%></option> <% rs.movenext loop %> </select> </td> </tr>



LinkBack URL
About LinkBacks
Reply With Quote
Let me know if you need more info.

Bookmarks