Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing A Javascript Value to ASP on the same page?

Status
Not open for further replies.

Gail1111

MIS
Apr 8, 2003
8
0
0
US
I have worked with the script and it still does not work. :(
Unfortunately, I can not get this to work. I know what I would like
to have happen, which to have the value in "strdiv" into the SQL statement.

I can read the DivisionID value which I am passing with the javascript, but
do not understand how to get that value into the SQL.
AND then, when the user changes the DivisionName have the javascript update "strdiv" with the new DivisionID value.

This is not I have my web layed out from top to bottom.
All suggestions toward getting this thing to work is appreciated.

Thank you.

Gail

SELECT SectionUnit.*, Division.DivID
FROM Division INNER JOIN SectionUnit ON Division.DivID = SectionUnit.DivisionID
WHERE Division.DivID LIKE "the value of strdiv needs to go here";

Set RS2 = cnnSearch.Execute(SectionSQL)

<script language=&quot;javascript&quot;>
<!--
var strdiv
strdiv = document.Listing.CorrectDivisionName.options[document.Listing.CorrectDivisionName.selectedIndex].value;
alert(strdiv)
//-->
</script>

</font>
</td>
<td bordercolor=&quot;#990066&quot; valign=&quot;top&quot; height=&quot;18&quot; bgcolor=&quot;#DFF4FF&quot; colspan=&quot;2&quot;>
<font color=&quot;#FFFF00&quot;>
<select name=CorrectSectionName&quot;>
<% While Not RS2.EOF %>
<% If Trim(Session(&quot;SectionUnitName&quot;)) = Trim(RS2.Fields(&quot;SectionUnitName&quot;)) Then %>
<option value=&quot;<%=RS2.Fields(&quot;DivisionID&quot;)%>&quot; SELECTED><%=RS2.Fields(&quot;SectionUnitName&quot;)%></option>
<% Else %>
<option value=&quot;<%=RS2.Fields(&quot;DivisionID&quot;)%>&quot;><%=RS2.Fields(&quot;SectionUnitName&quot;)%></option>
<% End If %>
<% RS2.MoveNext
Wend
%>
</select>

PLEASE help.
 
Gail, separate the two issues and tackle them singly first, it makes like simple. Use a plain HTML <select> element and get the javascript working without the server side code to generate the HTML. Once you see how that works all you need to do is write the server code to generate the HTML correctly.

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top