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 drop down list HTML

Status
Not open for further replies.

dl01

Technical User
Jun 25, 2001
15
NL
Hi

I run a script daily that generates me an XML file with date in the name ie. (22_11_2003_ErrorLog.xml)

I need a HTML page that when opened will display a drop down box listing the dates in the names of the XML files.

When a specified date has been selected the corresponding XML file should then be opened in the browser.

At the moment I am generating a static HTML file to accompany the corresponding XML which sort of defeats the object!

Here is my current solution:

<html>
<body>
<xml id=&quot;cdcat&quot; src=&quot;..\XML\23_11_2003_ErrorLog.xml&quot;></xml>
<table border=&quot;10&quot; datasrc=&quot;#cdcat&quot;>
<tr>
<td><span datafld=&quot;SERVERNAME&quot;></span></td>
<td><span datafld=&quot;ERRORTYPE&quot;></span></td>
<td><span datafld=&quot;ERRORCODE&quot;></span></td>
<td><span datafld=&quot;ERRORNAME&quot;></span></td>
<td><span datafld=&quot;DATE&quot;></span></td>
</tr>
</table>
</body>
</html>


Thanks in advance.

 
Well, your directory page could use FSO to generate dynamic links, something like:
Code:
<%
Option Explicit
Dim fso, fol, fil
Set fso = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set fol = fso.OpenFolder(Server.MapPath(&quot;..\XML\23_11_2003_ErrorLog.xml&quot;))

For Each fil in fol.Files
   'if it contains ErrorLog.xml
   If InStr(fil.name,&quot;ErrorLog.xml&quot;) > 0 Then
      'display a link to the display page
      Response.Write &quot;<a href=&quot;&quot;displayPage.asp?file=&quot; & fil.name & &quot;&quot;&quot;>&quot; & fil.name & &quot;</a>&quot;
   End If
Next

Set fol = Nothing
Set fso = Nothing
%>

Then your display page:
Code:
<%
Option Explicit
%>
<html>
<body>
<xml id=&quot;cdcat&quot; src=&quot;..\XML\<%=Request.QueryString(&quot;file&quot;)%>&quot;></xml>
<table border=&quot;10&quot; datasrc=&quot;#cdcat&quot;>
<tr>
<td><span datafld=&quot;SERVERNAME&quot;></span></td>
<td><span datafld=&quot;ERRORTYPE&quot;></span></td>
<td><span datafld=&quot;ERRORCODE&quot;></span></td>
<td><span datafld=&quot;ERRORNAME&quot;></span></td>
<td><span datafld=&quot;DATE&quot;></span></td>
</tr>
</table>
</body>
</html>

And that should have you covered. Now I would probably do something a little fancier on the links in the first one, like parsing out the date and just display a list of dates, or better yet display a list of dates in a select box and then going to the display page when they select a date from the dropdown, but that falls into prettying things up, the code above should be the basics of what you need. Forgive any errors, I wrote it on the fly so there may be the odd syntactical error that I didn't notice when writing it.

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
Many thanks for your response Tarwn. I should have mentioned that I am not a very experienced HTML user.

What I had in mind for this was exactly what you have suggested by displaying a list of dates in a select box and then going to the display page when they select a date from the dropdown list.

Could you please help me with some code to do this?

Many thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top