Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Dropdown and Textarea properties
Old 12-01-2004, 01:17 PM Dropdown and Textarea properties
barbara's Avatar
Skilled Talker

Posts: 79
Trades: 0
What is the properties for dropdown box and textarea input box? what i am trying to do is that i will retrieve information from the database table and populate it on the form if the the database is not empty.

I use "Value" for regular text box as below.
eg.

<select size="1" name="WhichTest" value= "<% if varTRNo <> "" then %><%=varTRNo%><%end if%>" tabindex="2">


My dropdown box and text area box's value does not show even when there's is value in the database.

please help!

thanks
barbara is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-01-2004, 02:18 PM
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
Your post is confusing me a bit. You mentioned three form elements in your post... dropdown, text box, and textarea. But you gave an example of an inproperly used dropdown. Dropdowns are for multiple values that the user can select from. Is that what you want?

What exactly are you trying to do and what input type do you need to use? I apologize for not being of more help, but I'm having a hard time understanding what your trying to accomplish.
Anacrusis is offline
Reply With Quote
View Public Profile
 
Old 12-02-2004, 10:42 AM
barbara's Avatar
Skilled Talker

Posts: 79
Trades: 0
what i am trying to accomplish is populating the field on the form if the data exist in the database.

this is what i have at the top of my page(also have a utilitiy for the function):

SQL = "SELECT * FROM tblAbrasions where TestID = " & CDbl(request.querystring("testorderid") )
'Check to see if values exist
if CkExistence(strSQL) = 0 then
'A record does not exist currently. Start with empty display.
else
'A record exists. Get values.
'Declare all local variables

Set Conn = Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "C:/Inetpub/wwwroot/database/Sample.mdb"

Set rs=conn.execute(SQL)
'response.write sql

if Not rs.EOF then
rs.movefirst

varTestRequestNo = rs("TestRequestNo")
varWhichTest = rs("WhichTest")
varColorway = rs("Description")
varSample = rs("Sample")
varSample2 = rs("Sample2")
varSample3 = rs("Sample3")
varSample4 = rs("Sample4")
varSample5 = rs("Sample5")
varSample6 = rs("Sample6")
varAbrasionhead = rs("AbrasionHeadNo")
varTestMethod = rs("TestMethod")
varNotes = rs("Notes")
end if

rs.close
set rs=nothing

conn.close
set conn=nothing
end if
%>

======================
between the <body> </body>
======================
i have the exact variable above on a form. the below code is for if and only if the "whichtest" is not empty, then write the value of "whichtest" otherwise, it's an empty field, so leave it blank.

<select size="1" name="WhichTest" value= "<% if varTRNo <> "" then %><%=varTRNo%><%end if%>" tabindex="2">

"WhichTest" and TestMethod" use a dropdown box because it has multiple values. the rest of the field are just an input text box.

i got the textarea to show up. one of the dropdown box, i create the values. the other dropdown box, it populate from a table.

hope this clarify what i am trying to accomplish.

barbara is offline
Reply With Quote
View Public Profile
 
Old 12-02-2004, 10:20 PM
ACJavascript's Avatar
Humble Mod

Posts: 548
Location: CT, USA
Trades: 0
I think there are two contributing problems that might be effecting your code.

If you could explian your SQL query that would be great:

SQL = "SELECT * FROM tblAbrasions where TestID = " & CDbl(request.querystring("testorderid") )

Is testID a row that is holding test data or the PRIMARY KEY?

What is the querystring "testorderid" holding? DESC or ASC possibly?

Also your select box doesn't seem to be coded properly.
Try this:

<select size="1" name="WhichTest" tabindex="2">
<% if varTRNo <> "" then %><option value="<%=varTRNo%>"><%=varTRNo%></option><%end if%>
</select>

I would cycle through all of the values within the select box creating extra <options> instead of creating multiple Selects.

Try those two things and see if it helps. Good luck!
__________________

Please login or register to view this content. Registration is FREE
- 100 Satisfied Customers - Custom Programming and Web Development
ACJavascript is offline
Reply With Quote
View Public Profile Visit ACJavascript's homepage!
 
Old 12-03-2004, 09:11 AM
barbara's Avatar
Skilled Talker

Posts: 79
Trades: 0
thanks a bunch! it WORKS!
barbara is offline
Reply With Quote
View Public Profile
 
Old 12-03-2004, 08:06 PM
ACJavascript's Avatar
Humble Mod

Posts: 548
Location: CT, USA
Trades: 0
Congrats barbara, hard work always pays in the end
__________________

Please login or register to view this content. Registration is FREE
- 100 Satisfied Customers - Custom Programming and Web Development
ACJavascript is offline
Reply With Quote
View Public Profile Visit ACJavascript's homepage!
 
Reply     « Reply to Dropdown and Textarea properties
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23979 seconds with 12 queries