Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 04-11-2005, 03:01 AM   #1 (permalink)
awieds
Registered User
 
Join Date: Mar 2005
Posts: 42
awieds is on a distinguished road
reset Variable in HTML

I think this is fairly simple but I am stuck on it. I have a page with a menu where the user selects something. based on what he selects I run a query and set a variable. (All this I've done)
Now I have a textbox and I want to set it to that variable. It's set, and onChange the variable changes but how do I reset the texbox to the new value of the variable? Here are the snippets from my code:

Code:
sub DescTest(prod)
	dim desRS
	dim strSelect
	Set desrs = Server.CreateObject("ADODB.Recordset")
	strSelect="Select description from productdescription where productid= " & prod
	desrs.Open strSelect, MM_myConn_STRING, 3, 2 ,1
	
	strDescription=desRS("description")
	rs.close()
end sub

<select name="Products" id="products" onChange="DescTest()">
			<%dim j
			for j=lbound(arrproducts) to ubound(arrproducts)-1%>
				<option value=<%=arrproducts(j,1)%>><%=arrproducts(j,0)%></option>
			<%next%>
		</select>


<textarea  name="description" cols="65" rows="9"><%=strdescription%></textarea>
awieds is offline   Reply With Quote
Old 04-11-2005, 06:39 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
i don't know asp well enough to type it off the top of my head, .. but here is some suedo code. mySubmittedValue will have to be set somewhere above the for loop.
Code:
<select name="Products" id="products" onChange="DescTest()">
  <%dim j
  for j=lbound(arrproducts) to ubound(arrproducts)-1
    Response.Write "<option value=" & arrproducts(j,1)

    If arrproducts(j,0)= mySubmittedVariable
      Response.Write " selected"
    End If

    Response.Write ">" & arrproducts(j,0) & "</option>"
  next
  %>
</select>
like i said, i don't know asp very well, but this is the logic i might use with PHP. ( with a lot less code )
__________________
Mike
sde is offline   Reply With Quote
Old 04-11-2005, 11:32 PM   #3 (permalink)
awieds
Registered User
 
Join Date: Mar 2005
Posts: 42
awieds is on a distinguished road
My code is not even going into the procedure I am calling! Am I calling it wrong?
<select name="Products" id="products" onChange= "DescTest()">
awieds is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with launching an exy within HTML. Nicotine HTML, XML, Javascript, AJAX 5 05-12-2004 03:00 PM
Changing variable type for edit box : mfc - .net sde Standard C, C++ 0 01-31-2003 09:53 AM
creating dynamic variable names sde PHP 5 11-02-2002 09:03 AM


All times are GMT -8. The time now is 06:39 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting