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

Dynamic List/Menu 1

Status
Not open for further replies.

redbay

Technical User
Oct 13, 2003
145
GB
I have a dynamic menu on a page and would like that when the user opens the page the drop down menu box shows "please select option", is there a way of doing this?
 
<option value="select" selected>Please select option</option>

[cheers]
Cheers!
Laura
 
select the menu then click on list values in the properties panel and you can add as many extra options as you like

[Peace][Pipe]
 
I would have thought that adding an initial value would do the trick.

Mark
 
Cheech when i change the menu to a list the list values option remains greyed out.

Laura i have tried your code and nearly got there, this is my code
<option value="<%=(rsdd.Fields.Item("Category").Value)%>" <%If (Not isNull((rsdd.Fields.Item("Category").Value))) Then If (CStr(rsdd.Fields.Item("Category").Value) = CStr((rsdd.Fields.Item("Category").Value))) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(rsdd.Fields.Item("Category").Value)%></option>

I tried putting yours tothe front of this but just got a load of Please select option in the drop down box?
 
redbay,

Unfortunately ASP is not my forte:

Here's pseudocode:
Code:
var string = "";
string = "<option value="select" selected>Please select option</option>";
while(retrieving database results){
  string .= '<option value="result">text</option>'; // the .= being concatenation operator
}
print string;

I hope this helps!

[cheers]
Cheers!
Laura
 
asp code generated with Dreamweaver
Code:
<select name="select">
    <option value="">** Please select **</option>
    <%
While (NOT Recordset1.EOF)
%>
    <option value="<%=(Recordset1.Fields.Item("fldID").Value)%>"><%=(Recordset1.Fields.Item("fldTitle").Value)%></option>
    <%
  Recordset1.MoveNext()
Wend
If (Recordset1.CursorType > 0) Then
  Recordset1.MoveFirst
Else
  Recordset1.Requery
End If
%>
  </select>

[Peace][Pipe]
 
Cheech

Thanks once again - this works wonderful.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top