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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT box with blank rows

Status
Not open for further replies.

SimonFinn

Programmer
Mar 13, 2003
130
GB
Hi Guys,

I have been looking at this code for ages and cant see the problem. The Box on the page returns the results from a database query, i have tested the Query and it is fine. It creates 26 rows in the select box, but they are blank. I have checked the CSS and that isnt the problem. When i highlight the rows the text does not appear (as it would if it was white text).

Can anyone spot the problem, i would be very greatful of any help

Cheers Si,

here's the code, PS i have removed email/web addresses and replaced them with "???":


<%
const strTableAnd = &quot;tblCandANDSkill_IT&quot;
const strTableExc = &quot;tblCandExcludeSkill_IT&quot;

Dim gstrConnStr
Dim cn
Dim rs
dim lngCandID
dim strSQL

Sub DBConnect
gstrConnStr = &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\Set cn = Server.CreateObject(&quot;ADODB.Connection&quot;)
cn.Open gstrConnStr
End Sub

Sub DBDisconnect
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub

dbconnect()

set rs = cn.Execute(&quot;SELECT MAX(CandID) FROM &quot; & Request.QueryString(&quot;tb&quot;) & &quot; WHERE [First Name] = '&quot; & Request.QueryString(&quot;fn&quot;) & &quot;' AND [Last Name] = '&quot; & Request.QueryString(&quot;sn&quot;) & &quot;'&quot;)
lngCandID = rs.fields(0).value

strSQL = &quot;SELECT Distinct(skills.skill) AS Skill FROM &quot; & strTableAnd & &quot; inner join skills on &quot; & strTableAnd & &quot;.skillID = skills.skillID WHERE &quot; & strTableAnd & &quot;.CandID = &quot; & lngCandID & &quot; ORDER BY skill&quot;
set rs = cn.execute(strsql)
'response.write strsql
do while rs.eof = false
optionStr = optionStr & &quot;<option value='&quot; & rs(&quot;Skill&quot;).value & &quot;'>&quot;
rs.movenext
loop
dbdisconnect()

%>

<html>

<head>
<title></title>
</head>
<link rel=&quot;stylesheet&quot; href=&quot; type=&quot;text/css&quot;>
<body>
<table border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;5&quot; align=&quot;center&quot; width=&quot;514&quot; style=&quot;BORDER-RIGHT: #000052 1px solid; BORDER-TOP: #000052 1px solid; BORDER-LEFT: #000052 1px solid; WIDTH: 514px; BORDER-BOTTOM: #000052 1px solid; BACKGROUND-REPEAT: no-repeat; HEIGHT: 402px; BACKGROUND-COLOR: #ffffff&quot;>
<tr>
<td>
<P align=center><span class=&quot;title&quot;><FONT style=&quot;FONT-WEIGHT: normal&quot;
size=2><STRONG>Upload CV</STRONG>&nbsp;| Update Skills | <STRONG>Personal
Details</STRONG></FONT> </span></P>
<P><SPAN class=title>IT Recruitment - Update Skills</SPAN><br >
Please type your details in the form below. You can upload your CV as a file (Word
document preferred) or you can paste details into the text box provided (Those fields
marked with a * are mandatory). If you have already registered with us and wish to give us
an update or you are unsure, there is no need to complete this form you can forward your
CV via email to <A href=&quot;mailto:paul@????.com&quot;>Paul ????</A><br
></P>
<P align=center>
<FORM name=myForm>
<TABLE cellPadding=3 width=385 border=0>

<TR>
<TD align=left width=607 colSpan=3>
<DIV align=left>
<P>Your skills have been extracted from your CV and are listed
below.&nbsp; Please exclude any skills that you do not wish to be
included in our vacancy searches: </P></DIV></TD></TR>
<TR>
<TD align=middle width=145>
<P align=center><STRONG>Skills</STRONG></P></TD>
<TD align=middle width=149>
<P align=center>&nbsp;</P></TD>
<TD align=middle width=313>
<P align=center><STRONG>Excluded Skills</STRONG></P></TD></TR>
<TR>
<TD width=145>
<P align=center><SELECT id=clients1
style=&quot;WIDTH: 160px; COLOR: black; HEIGHT: 266px&quot;
multiple size=5
name=clients1><%=optionStr%></SELECT> </P></TD>
<TD width=250>
<CENTER><INPUT onclick=&quot;moveIt('del',document.myForm.clients2.selectedIndex)&quot; type=button value=&quot;Include&quot; style=&quot;WIDTH: 61px; HEIGHT: 22px&quot; size=51><INPUT onclick=&quot;moveIt('add',document.myForm.clients1.selectedIndex)&quot; type=button value=&quot;Exclude&quot; style=&quot;WIDTH: 61px; HEIGHT: 22px&quot; size=52>&nbsp;
</CENTER></TD>
<TD align=middle width=313>
<P align=center><SELECT id=clients2
style=&quot;WIDTH: 160px; COLOR: black; HEIGHT: 264px&quot;
multiple size=5
name=clients2></SELECT> </P></TD></TR>
<TR align=middle>
<TD width=145>
<P align=left><INPUT type=submit value=Submit name=Submit></P></TD>
<TD width=250>
<P align=right>&nbsp;</P></TD>
<TD width=313>
<P align=right>&nbsp;</P></TD></TR></TABLE>
<SCRIPT language=JavaScript>

function moveIt(action, thisOption){
if (thisOption == -1){
return false;
}
if (action == 'add'){
c2 = document.getElementById(&quot;clients2&quot;)
c2.options[c2.options.length] = new Option (document.myForm.clients1[thisOption].text, document.myForm.clients1[thisOption].value)
c1 = document.getElementById(&quot;clients1&quot;)
c1.options[thisOption] = null
}
if (action == 'del'){
c1 = document.getElementById(&quot;clients1&quot;)
c1.options[c1.options.length] = new Option (document.myForm.clients2[thisOption].text, document.myForm.clients2[thisOption].value)
c2 = document.getElementById(&quot;clients2&quot;)
c2.options[thisOption] = null
}
}
</SCRIPT>
</FORM></P>
</td>
</tr>
</table>
</body>
</html>
 
It's late and yours is a long code, but as I see it, you are writing your optionstring here:

optionStr = optionStr & &quot;<option value='&quot; & rs(&quot;Skill&quot;).value & &quot;'>&quot;

that would produce (for two values that I made up) something like this:
<option value='15'><option value='16'>

That would mean your output is correct in not showing anything, since correct <option> syntax is:

<option value='15'>15</option>

Change your script so that it will produce something like that and check if it works.

Hope it helps.
 
Thanks, u have been a life saver.... I have spent so long looking through it for the problem!!

Thanks Again!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top