Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-22-2003, 08:00 PM   PM User | #1
atferraz
New Coder

 
Join Date: Aug 2003
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
atferraz is an unknown quantity at this point
select option <- Data problem

Hello,
Have this problem in getting the right option from drop box to show when I edit a DB row in my form.
Firs I get the options fields (2) from a table to a array. Then I ask de number of de row to search for on the DB and show it on the form.
In the middle of that process, I fill the select options from the array and on each iteration I test if that option match the correspondent DB option field. If it does, that option get the "selected" attribute witch should define it to show. But it doesn't


SQLstm="Select nfunc FROM xpto"
rs.Open SQLstm,Lig,1,2
Dim i, arrXpto(3)

rs.MoveFirst
for i=0 to 2 ' get codes from xpto
arrXpto(i)= rs("nfunc")
rs.MoveNext
Next
rs.close

SQLstm="Select * FROM users where nuser="&userNumber 'get specific row from users where the cod is inserted by user
rs.Open SQLstm,Lig,1,2
.....
Response.Write"<select Class='form' name='funcao' style='position:relative; left:0px;'>" ' drop box
for i=0 to 2 'put the array fields on de options
Response.Write "<option class='form' value='" &arrXpto(i,0)
if cInt(arrXpto(i,0)) = cInt(rs("nfuncao")) then ' if the code option match with the row option field then is selected
Response.Write"selected"
end if
Response.write "</option>"
Next
Response.Write"</select>"
atferraz is offline   Reply With Quote
Old 10-22-2003, 10:35 PM   PM User | #2
Roy Sinclair
Senior Coder

 
Join Date: Jun 2002
Location: Wichita
Posts: 3,880
Thanks: 0
Thanked 0 Times in 0 Posts
Roy Sinclair will become famous soon enough
Your code is writing incomplete html code, nowhere are you writing the ">" for the <option> tag. You also need to add a space before "selected" and you also need to put the closing quote mark on the value of that option.
__________________
Check out the Forum Search. It's the short path to getting great results from this forum.
Roy Sinclair is offline   Reply With Quote
Old 10-23-2003, 02:44 AM   PM User | #3
atferraz
New Coder

 
Join Date: Aug 2003
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
atferraz is an unknown quantity at this point
Many thank Roy. At that hour anything goes wrong
atferraz is offline   Reply With Quote
Old 10-23-2003, 07:33 AM   PM User | #4
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf will become famous soon enoughraf will become famous soon enough
You may as well make it valid XHTML...

http://www.codingforums.com/showthre...threadid=27892
raf is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 06:35 AM.


Advertisement
Log in to turn off these ads.