Click to See Complete Forum and Search --> : Fill select options from a data file


moreta
08-19-2003, 01:40 PM
I have a large data file of information. (Did I mention "large"?) Based on information provided by the user (in a Form), I need to extract appropriate information from the data file and fill Options for another field on the form.

What is the simpliest way to do this? :confused: I've read threads referring to Perl and PHP, but don't have a clue how to fit them into my HTML... or if other programming languages must be installed on the server to use them. Since the server is in-house and installing cgi was a baffling trip, please remember the key word "simple."

Thank you,
moreta

P.S. I'm away for the rest of the day, so please excuse that I won't be able to respond to suggestions until tomorrow morning. -- m

Khalid Ali
08-19-2003, 01:58 PM
There are few options.
If its possible and you can create your data file in XML then you do not need server side languages.You can use XSL to create your html(limits you to only NS6+ and IE6+ browsers).

Otherwise you can use jsp/php and/or any other server side language to read the data.
If you have no idea what all of the above means then it will be a tough solution for you.

PeOfEo
08-19-2003, 05:01 PM
When you are using a server side language you do not fit it into your html. It creates the html dynamically adding it to display the data that is in the data base, it is called a server side language because the server executes this task and creates the code for you.

moreta
08-20-2003, 08:30 AM
PeOfEo -- I appreciate the explanation. The thread content that I've read is less confusing with this basic information.

Khalid -- I thought XML was for structure data... not to contain the data itself? Is it used to actually hold data (as in a series of data records)? If so, that may be a new playground to check out.

Thanks to both of you. Your responses allowed me to make the informed decisions to... do it another way. ;) I don't have time on this project to locate, install, and enjoy the learning curve that would be associated with another server-side language.

We're using a cgi program to build the html with legacy data. My problem is that before creating the html page, the program must know which data to include. I'll try faking the same page (really a new page). That way I can pass the correct data as thought it was determined in the middle of the page. (If it isn't too slow.) It's worth a shot.

If you have ideas that might help, please let me know. I'm mostly flying by the seat of my pants and lots of reference/documentation sites -- helpful, but not as good as experience.

Thanks you!
moreta

Fang
08-20-2003, 11:01 AM
Khalid Ali was correct. Using XML (data) and XSL (data processor) could be the solution for you - look at this simple example (http://www.w3schools.com/xsl/xsl_if.asp), not an Options list, but a table. The idea is the same.

moreta
08-20-2003, 11:24 AM
XLS has potential, but the example site and Khalid Ali's post both note that it works only with IE/Netscape version 6. We're a bit of a closed shop on browsers, but we don't have that much power. :rolleyes:

Thanks for the site link and suggestion!

moreta

Khalid Ali
08-20-2003, 11:34 AM
how big is the data file? if you don't mind me asking.
There is another approach, that you embed the XML data inside a page and then you can use DOM methods to access it an create whatever html elements you want from it.

here is an example.
http://www.webapplikations.com/pages/html_js/xmlstuff/XMLDataIslandNSAndIE.html

in most cases best option will still be the server side dynamic page creating algorithm

moreta
08-20-2003, 12:57 PM
how big is the data file? if you don't mind me asking. 54,000+ records. Almost 20M, but I can pare down the record size to critical data... probably the number of records, slightly... but still too big to embed (IMHO).
There is another approach, that you embed the XML data inside a page and then you can use DOM methods to access it an create whatever html elements you want from it.
I'd love to try it on some of my smaller databases (there will be several). Embedded XML with DOM might be less problematic than a server-side language. I'll check out the link you suggested as soon as I send this.

I'm wondering whether I might use a pop-up window for the created field...? Not sure how/whether this would work within a form... running another page in another window in the middle of a form.

I'll see how much I can pare down the data (length and number of records), so I'll know my limitations. Maybe it will surprise me (in a good way). :D

in most cases best option will still be the server side dynamic page creating algorithm I'll keep in mind that I need to move this direction eventually, so will try to learn more about options and which might work best for us. I cringe thinking about making our cgi compatible with another server-side language. But, it would be a thing of beauty when completed. :cool:

moreta

Khalid Ali
08-20-2003, 01:24 PM
Originally posted by moreta
54,000+ records. Almost 20M
moreta

bump
cripes...:D
try loading that in a browser.lol

moreta
08-20-2003, 01:39 PM
That's why my goal is to load only a small subset. You should see the file before we distill it.... :eek:

Khalid Ali
08-20-2003, 01:42 PM
Originally posted by moreta
You should see the file before we distill it.... :eek:

yeah sure why not....email me if you wish...I might be able to lend you a hand.:D

Fang
08-20-2003, 04:19 PM
If your using Internet Explorer you could use ADO (ActiveX).

moreta
08-20-2003, 04:30 PM
IE 4, 5, and 6? If so, would you mind explaining further... maybe pointing me to an example? (I've found that very helpful in quickly grasping the basic concept in other posts.)

Thank you!
moreta

Fang
08-20-2003, 04:42 PM
This example is from "Inside Dynamic HTML by Scott Isaacs".
Name the following file whatever you like, i.e. ProcessData.html

<!-- Data source object to supply the Select element options -->
<OBJECT ID="selectlist" WIDTH="0" HEIGHT="0"
CLASSID="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
<PARAM NAME="DataURL" VALUE="selectd.txt">
<PARAM NAME="UseHeader" VALUE="True">
</OBJECT>

<!-- List to be populated -->
<SELECT ID=typeselect>
</SELECT>

<SCRIPT FOR=window EVENT=onload() LANGUAGE="JavaScript">
var i, newop;

selectlist.recordset.MoveFirst();
for (i = 1; i <= selectlist.recordset.AbsolutePosition; i++) {
newop = document.createElement("option");
newop.value = selectlist.recordset("value");
newop.text = selectlist.recordset("display");

typeselect.add(newop);
selectlist.recordset.MoveNext();
}
</SCRIPT>

... and the data file: selectd.txt

value, display
AZ, AZ
NJ, NJ
NY, NY
WA, WA

The data file can be any configuration or layout you choose, provided it's reflected in the <OBJECT>

moreta
08-21-2003, 08:58 AM
CLASSID="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83 I won't pretend to understand everything in the code... but if your example includes all the components, i.e. no server-side languages required, it's wonderful!

<PARAM NAME="DataURL" VALUE="selectd.txt"> Can I change the VALUE on the fly with JS? If so, I can break the 54000 recs into file subsets, change the VALUE filename based on other entered criteria, and viola I have a selective select list. :cool:

Not ideal for the purist, but what a great compromise between getting the result and restricting setup/learning curve. Please may it be as simple and effective as it appears to be.

Could you recommend a good site where I can find more information, documentation, etc?

moreta :)

Khalid Ali
08-21-2003, 09:51 AM
I am all eyes to see if the example posted above will work from internet(ITS IE who am I kidding) as well,it might work from local machine.

Fang
08-21-2003, 09:56 AM
You should be able to change the file name in the fly with javascript or 5 objects.
Microsoft reference (http://msdn.microsoft.com/library/default.asp?url=/workshop/author/databind/data_binding.asp)
Scott Isaacs website (http://www.siteexperts.com/Home.asp), do a search for articles on subject.
There is a forum, but Scott rarely participates.
Just a Google search (http://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=data+binding+with+HTML) is useful.
... and I will be here if needed.

Fang
08-21-2003, 10:08 AM
Khalid Ali, I've just uploaded the example to my website -no problems. :p

Khalid Ali
08-21-2003, 11:28 AM
lol..as I said its IE who was I kidding..

moreta
08-21-2003, 11:45 AM
(relief, relief)

Khalid -- Where's your belief in happy endings? They're not all fairy tales. ;)

Fang -- Thanks for the sites. Let me read up on it, tinker with it, and work on the back end of the data. It'll take me awhile (I have to do other stuff, too. Can you imagine that? :rolleyes: ) And... I'm out for vacation next week -- there will be NO COMPUTERS for the duration. It's time to look at the sky, the water, and all the wonderful things one can see without a monitor. Is that blasphemy in a web forum?:D ... and I will be here if needed.Many, many thanks. I want to do it myself, but odds are that I'll get stuck or confused about something. It's reassuring to know that I can come back for help.

Thanks everybody! I've learned SO MUCH on this thread!
moreta

PeOfEo
08-22-2003, 04:22 PM
Originally posted by moreta
PeOfEo -- I appreciate the explanation. The thread content that I've read is less confusing with this basic information. Lol I am happy I helped (beats confusing you)