Listbox - Web Expressions 4

JimmyC
3StarLounger
Posts: 382
Joined: 08 Feb 2010, 16:08

Listbox - Web Expressions 4

Post by JimmyC »

I have spent the last several hours, Googling...and I am no closer to learning the information I seek---I must be a "bad" googler and/or lousy with search terms. :laugh:

Anyhow, I would like to create a dynamic--one column listbox for a webpage. The listbox will populate from a text file, etc. The link from the item selected in the listbox will either be to another web page, a PDF or open a folder for user file selection.

So for example, assume I have the following names in a text file:

Adams, Marty---then the link to Adams' page or pdf or a folder to open
Brown, Kevin--then the link to Brown's page or pdf or a folder to open
Smith, Wilber -- then the link to Smith's page or a pdf or a folder to open

Only the names display in the listbox ---if the user clicks on a name--then it goes to the respective web page (i.e. I will also need the ability to link to a PDF or open a folder for user selection). All "on-going" maintenance (adding new names---deleting some too) would be done in the text file. The listbox object size would remain fixed as it was when created and would use a vertical scroll bar if needed should the list grow beyond what can displayed.

I am not opposed to buying an add-in for Web Expression4 to make this happen....but I have seen 100's of dynamic menu generators---but nothing about a "listbox"--at least that can be used with Web Expression4. I should mention the listbox will be used on my employer's intranet site only and all employees use IE 7 or IE 8 as the web broswer.

Any and suggestions are welcome. Thank you for reading...
JimC

User avatar
agibsonsw
SilverLounger
Posts: 2403
Joined: 05 Feb 2010, 22:21
Location: London ENGLAND

Re: Listbox - Web Expressions 4

Post by agibsonsw »

Hello.
HTML alone cannot read a text file. As you are using only IE, you can use an ActiveX control to read a text file. I think you possibly need an <object> tag within your page and then the assistance of your server-side language (VBScript or JScript in IE) to parse the file - that is, to extract the information you need.
Javascript (or JScript) can more easily read an XML file (possibly using the XMLHttpRequest object). An XML is a simple text file but uses (HTML-Like) tags to identify the data:
Something like: <staff><name>Adams, Marty</name><hislink>http://adamsstuff.com</hislink> etc.. </staff>
You might find it easier to get the data you need from an XML file - but that's as far as my knowledge extends (currently..). Andy.

Added: Web Expressions probably has an option to insert an ActiveX object - that might get you started :smile:
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.

User avatar
jscher2000
2StarLounger
Posts: 148
Joined: 26 Dec 2010, 18:17

Re: Listbox - Web Expressions 4

Post by jscher2000 »

JimmyC wrote:I would like to create a dynamic--one column listbox for a webpage. The listbox will populate from a text file, etc. The link from the item selected in the listbox will either be to another web page, a PDF or open a folder for user file selection.

So for example, assume I have the following names in a text file:

Adams, Marty---then the link to Adams' page or pdf or a folder to open
Brown, Kevin--then the link to Brown's page or pdf or a folder to open
Smith, Wilber -- then the link to Smith's page or a pdf or a folder to open

Only the names display in the listbox ---if the user clicks on a name--then it goes to the respective web page (i.e. I will also need the ability to link to a PDF or open a folder for user selection). All "on-going" maintenance (adding new names---deleting some too) would be done in the text file. The listbox object size would remain fixed as it was when created and would use a vertical scroll bar if needed should the list grow beyond what can displayed.
The formal HTML control for a listbox is a <select> with a size attribute (size="numberOfRows"). If you omit the size attribute, it's a drop-down.

Consider, however, the alternative of using an unordered list element (<ul>) in a scrolling box. You can style a list with no bullets so it will look like a listbox, but you have a lot more formatting flexibility with a list than with a <select>. I think also attaching links is much more straightforward, and you can turn off the link's text-decoration so it looks like a regular list.

As Andrew notes, you may need to do a little ASP or ASP.Net or other coding to import a file and/or access a database. Plain old HTML files are not that interactive. Well, you could deliver the page "empty" and use client-side javascript to pull down the data and fill in the listbox, but it's more reliable to just serve the page fully formed.

And I should add: Expression Web probably has some controls pre-built, but these might assume you are storing your list in SQL Server, which seems like overkill for this application...