just wondering... is there a quick n dirty way to auto-arrange OPTION values by alphabetical order? I've got tons of OPTION values, and they appear in the order I created them. Would like to have them sorted.
My code snippet as follows:
<option value="MS Office 2000">MS Office 2000</option>
<option value="MS Office XP">MS Office XP</option>
<option value="MS Outlook">MS Outlook</option>
<option value="Windows ME">Windows ME</option>
<option value="Windows Media Player">Windows Media Player</option>
<option value="Windows 2000">Windows 2000</option>
<option value="Windows XP">Windows XP</option>
<option value="Windows NT">Windows NT</option>
<option value="webEx">webEx</option>
<option value="Instant Messaging">Instant Messaging</option>
<option value="IRL World Dialler">IRL World Dialler</option>
<option value="MS Excel">MS Excel</option>
<option value="MS Access">MS Access</option>
<option value="MS FrontPage">MS FrontPage</option>
<option value="MS Internet Explorer 5">MS Internet Explorer 5</option>
<option value="MS Internet Explorer 5.5">MS Internet Explorer 5.5</option>
<option value="MS Internet Explorer 6.0">MS Internet Explorer 6.0</option>
<option value="MS Powerpoint">MS Powerpoint</option>
<option value="MS Project">MS Project</option>
<option value="Netmeeting">Netmeeting</option>
<option value="MS Visio">MS Visio</option>
<option value="WinZip 8.0">WinZip 8.0</option>
<option value="IRL-VPN">IRL-VPN</option>
<option value="DSL">DSL (Non Supported)</option>
<option value="SOHO">SOHO</option>
<option value="SoftID">SoftID</option>
<option value="SecurID">SecurID</option>
<option value="Wireless">Wireless (WiFi)</option>
<option value="AudioBridge">AudioBridge</option>
Originally posted by Paul S Where do you have those string stored? Try putting them into a database and then create the option boxes dinamically, what would be your best choice.
Paul
well, they're stored in an ASP file (my site's ASP driven with a SQL Server d/b backend).
Is there any way of doing this other than generating the options via a d/b?
It's either manual (i.e. do it yourself), or put it in a database and sort alphabetically in your query. From the looks of things I'd say it would be best to throw this in a database anyway, especially if you change it a lot.
Originally posted by infinitium Is there any way of doing this other than generating the options via a d/b?
Well if I wasn't allow to put those strings into a database then I'd use an editor that would help me to remove the html tags and leave only the strings (you can create and ASP or PHP script to do this too), then I'd use Excel to simply sort them.
it's late, so i won't bother attempting to write asp code (which i'm bad at anyway), but i'd just put all those options in an array if i didn't have access to a database, sort the array programmatically, then do a loop to generate the options...
Originally posted by redux it's late, so i won't bother attempting to write asp code (which i'm bad at anyway), but i'd just put all those options in an array if i didn't have access to a database, sort the array programmatically, then do a loop to generate the options...
yeah, i figured that would be the only way.. oh well... thanks anyway!
Try creating a recordset on the fly and using its sort method:
Dim myObject
Set myObjects = myObject
Dim myRecordset
Set myRecordset =CreateObject("ADODB.RecordSet")
myRecordset.CursorLocation = 3 'client location
myRecordset.Fields.Append "myField1", 200, 100 'varchar 100 long
myRecordset.Fields.Append "myField2", 200, 400 'varchar 400 long
myRecordset.Open
For Each myObject In myObjects
myRecordset.AddNew
myRecordset.Fields("myField1").Value = myObject.myCollection("myField1").value
myRecordset.Fields("myField2").Value = myObject.myCollection("myField2").value
myRecordset.Update
Next
Bookmarks