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!

Dynamic Drop Down List

Status
Not open for further replies.

FateFirst

Programmer
Apr 15, 2002
212
GB
Hi.

I have wrote a dynamic drop down list function, and it works fine.....well it works fine in IE on the PC.

The problem occurs when using IE 5.1 on the MAC.

The drop down list is still created dynamically and the correct data is held within it, its just that within my function it checks to see whether 2 values are the same and if they are then it checks the relevant item as 'selected' then carries on creating the drop down list if it isnt eof.

On the MAC though it does check the item, but doesnt display it. So the drop list appears blank until you tab over it or select it and then suddenly the item shows....its almost as if its white text on white background and giving focus to the field changes the text to black....very weird!

Heres my code:
-------------------------------------------------------
Function MakeSelect(strName,strTable,strField,strDesc,strSelected)
strSqlMk = "SELECT " & strTable & ".[" & strField & "], " & strTable &".[" & strDesc & "]"

strSqlMk = strSqlMk & " FROM " & strTable & " ORDER BY " &strTable & ".[" & strField & "];"

Set Rs = GetRecordSet(strSqlMk)
ArrData = Rs.getrows

nNumcols=ubound(ArrData,1)
nNumrows=ubound(ArrData,2)

strFinal = &quot;<select name=&quot; & strName & &quot; autocomplete=&quot;&quot;off&quot;&quot;>&quot;
strFinal = strFinal & &quot;<option value=></option>&quot;

for i = 0 to ubound(ArrData,2)
if ArrData(0,i) = strSelected then
strFinal = strFinal & &quot;<option value=&quot;&quot;&quot; & ArrData(0,i) & &quot;&quot;&quot; selected>&quot; & ArrData(1,i) & &quot;<br></option>&quot;
else
strFinal = strFinal & &quot;<option value=&quot;&quot;&quot; & ArrData(0,i) & &quot;&quot;&quot;>&quot; & ArrData(1,i) & &quot;<br></option>&quot;
end if
next

strFinal = strFinal & &quot;</select>&quot;
MakeSelect = strFinal
End Function

'This is the code you insert on the page to create the drop down list

<%=MakeSelect(&quot;DROP DOWN VALUE&quot;,&quot;TABLE NAME&quot;,&quot;ORDER BY FIELD&quot;,&quot;DROP DOWN ITEM&quot;,VALUE TO CHECK)%>
-------------------------------------------------------

Quick explanation on the MakeSelect Function
DROP DOWN VALUE = The 'value' of the item in the list
TABLE NAME = Name of Table the data is taken from
ORDER BY FIELD = Order the list by this field name
DROP DOWN ITEM = Data displayed in the list (*not* value)
VALUE TO CHECK = This value is what defines what item in the list is selected.

I hope you can understand all this.

Any help would be much appreciated. If you need anymore code as I may have missed some out, then please let me know.

- FateFirst - FateFirst
 
Sorted...sorry to waste your time ppl!

- FateFirst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top