![]() |
| |||||||
![]() | « Previous Thread | Next Thread » |
| | LinkBack | Thread Tools | Display Modes |
| Sponsored Links |
| ||||
| Hmm...ya lost me on this. What exactly are you trying to do with this?
__________________ jmurrayhead Did I help you out? Make me popular by clicking the icon!If you found a post helpful, please click the button in the lower right-hand corner of the post.Powered by ASP.Net |
| ||||
| sorry JMurrayhead...let me see if i can explain a little better. I have field Mat Num which is a textbox when the page is loaded but have text next to it "Pick from list!", this will give a list instead of text box. If I pick a Mat num from the list, then I want to pull in all the matching Item Descriptions in a listbox in field called Item Description. Right now, it's pulling a list but it's not the list for the matching MatNum I pick. Let me know if you need more info. Thanks for your help! ![]() |
| ||||
| ok, here is a sample i hope helps explain....but i want to use it with a recordset...pulling from my table(s). also, something I just thought of....that's probably why you're confused....ok, if I don't pick from the list, then i would like Item Description to be a textbox, not a drop down list. Item description should only be a list if MatNum list is used. ![]() Last edited by Rebelle; June 16th, 2008 at 10:14 AM. Reason: attachment didn't attach...trying to attach. |
| ||||
| Am I missing something...the example doesn't do anything lol Another thing to think about is if someone doesn't type anything into MatNum, how is the code going to know that it needs to display a textbox instead of a listbox? Maybe provide a checkbox or something, that when checked, will hide the dropdownlist and display a textbox. Or, if the form is submit, check if MatNum has a value or not, and if not, display the textbox and hide the dropdownlist. |
| ||||
| Ok, I stumbled upon this, with the code like below...I added if statement to handle the Item Descripton field...when page is loaded, my Item Description field is a textbox which is good, then I select a "Category" then select "Size" then choose "Pick from list!" for MatNum, I can pick from list but it doesn't display the value I pick and it doesn't change the ItemDescription field to list, but if I go back and change my select for "Category" (this re-runs the onChange on this field which refreshes the page), it then recognizes the MatNum I picked but still doesn't show the matnum value in the matnum field, but it does load the correct list for Item Desc. 1) How can I get to pass the value I select for MatNum in the javascript function? When I attempted this yesterday, the forum was down so I posted the error at the other place.2) Even though I can go back and use "Category" to refresh the page....how can I make it display the value I selected for MatNum? function: 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>");
<%
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 += ("</select>");
change_span += ("change to textbox.");
objectType = 2;
}
document.getElementById("object_span").innerHTML = object_span;
document.getElementById("change_span").innerHTML = change_span;
}
<BODY class="clrBg" onload="changeFormObject()">
Code: <TR>
<TD CLASS="fieldLblB" WIDTH="120"><B>Category:</TD>
<TD>
<SELECT CLASS="clrBg" name="Category" onChange="document.form.action='<%=request.servervariables("Script_Name")%>';document.form.submit();">
<OPTION>
<%= GetOptionList("vwCat_Size", "CatID", "Category", " Order by Category", strCatID) %>
</OPTION>
</SELECT>
</TD>
</TR>
<tr>
<td>Size:</td>
<td>
<select size="1" name="ALSize">
<%
strSQL = "Select Distinct ALSize from vwCat_Size where CatID='" & strCatID & "' Order by ALSize"
set rs = conn.execute(strSQL)
do while not rs.eof %>
<option value="<%=rs("ALSize")%>"><%=rs("ALSize")%></option>
<%
rs.movenext
loop
%>
</select>
</td>
</tr>
<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>
<% if strMatNum = "" then%>
<TD>
<INPUT CLASS="clrBg" type="text" name="ItemDescription" size="50" maxlength="50" VALUE="<%= strItemDesc %>">
</TD>
<%else%>
<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>
<%end if%>
</tr>
|
| ||||
| a wittle closer...hehe added text in red, so now it holds the value: Code: objectType = 0;
function changeFormObject() {
var object_span = "";
var change_span = "";
if (objectType != 1) {
object_span += ("<input type='text' name='MatNum' value='<%= strMatNum %>'/>");
change_span += ("Pick from List!");
objectType = 1;
}
else {
object_span += ("<select name='MatNum'>");
object_span += ("<option value=''> - SELECT - </option>");
<%
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 += ("</select>");
change_span += ("change to textbox.");
objectType = 2;
}
document.getElementById("object_span").innerHTML = object_span;
document.getElementById("change_span").innerHTML = change_span;
}
thanks everyone! ![]() |
| ||||
| Sounds like you need to either: a.) Cause the page to post back to itself to refresh that data or... b.) Utilize AJAX to refresh the data without refreshing the whole page |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| text display problem | todd2006 | HTML & CSS Help | 10 | May 7th, 2008 08:14 PM |
| Sponsored Links |
| ASP.NET Resource Index a directory of ASP.NET tutorials, applications, scripts, assemblies and articles for the novice to professional developer. Free Web Directory Including Chats and Forums Resources, Offer automatic, instant and free directory submissions. | URLZ Web Directory URLZ Web Directory Free Web Directory - Add Your Link The Little Web Directory | Free Web Directory Pegasus free web directory is a free directory organised by categories. Web Directory & SEO Services dirroot web directory |