View Full Version : Web Design Help Requested
Aerick
07-11-2001, 11:02 AM
I have a project that just hit a proverbial cement wall. I'm trying to make a webpage in which people can enter numbers into a table, and 'it' will do some math and come to an output.
To be more specific, users enter a value on the left, which is the 'weight' of each category, and on the right they enter 1-4 numeric values. Each of the numeric values is multiplied by the 'weight' and then added vertically. I hope that makes sense, and that it's easy to do, and I just don't get it.
I have Dreamweaver, and I can probably get just about any program I need to do it (perk of a college IT dept). Is this feasible? Thankee kindly,
-Eric, who seems to be begging for help from his clanmates a lot, lately
Kiriel
07-11-2001, 12:09 PM
Anything of this nature will require a form, and some way to process the form. The two possibilities for processing are client side and server side.
In client side you'd use Javascript. Although this has the advantage that you don't have to care what your web server offers, it would only work for users whose browsers support Javascript (and have it enabled), and there are limits on what can be done with Javascript.
In server side, you'd use a script running on the server to calculate the information and print out the resulting page. Generally this means writing a CGI script, probably in Perl, although if you have PHP on your server, it's probably easier for simple forms.
The short answer is anything involving interactivity on the web is never simple, but generally doable and usually involves something beyond HTML.
Aerick
07-11-2001, 12:56 PM
I've been meeting a whole lot with the guy who knows more than I about this (but not too terribly much), and I've decided to place the situation in the 'his problem' category.
Except I'll probably start learning to program Java anyway. Apparently, our CGI server doesn't do what's needed, so I think it'll have to be Java.
I wish more of these situations could be resolved with a <compute and display data> </c&dd>
Thanks for the info, Kiriel.
-Eric
Kiriel
07-11-2001, 01:12 PM
Actually, you'll probably want to use Javascript, not Java. I think you could do it in Java but it'd be a lot messier.
Good luck.
Aerick
07-11-2001, 01:43 PM
...and so my ignorance shines forth...
=)
I'll ask what the difference is another time. <g>
Kiriel
07-11-2001, 03:04 PM
I'll answer anyways. Javascript is vaguely Java-like but they're not the same language. Only reason Javascript is called that is because Netscape wanted to get some of the benefits from the Java hype of the day. It's a common confusion. Javascript is a scripting language built into your browser- it's very easy to include Javascript code on a web page for a browser to run. Java can be used on the server or client side. Typically on the client side you embed a Java applet and it's basically its own little application, that happens to run in your browser window. Although you can interact with the rest of the page with Java I believe, most of the time when you want to make a web page and just script a few fields in a form, you would use Javascript.
Corwin
07-13-2001, 11:25 PM
Javascript is the thing I read, bleary-eyed in the mornings, to assist my sleepy memory on how to make coffee. Lovely, warm coffee...mmmm
Corwin
Caffeinated Clown
Aerick
07-19-2001, 12:57 PM
Well, this week, I've been learning to hack and patch Javascript together, and know a few basics (and have impressed everyone in my office). The thing I need to do, and can't come up with any examples to steal, or any explanations of it, is make a table with a variable number of columns and rows.
It basically needs to have the user input a number of columns and rows. Any ideas where I should look for this kind of information? Thanks
Konoko
07-19-2001, 02:19 PM
There was a web site that I used ages ago when I was first playing around with perl and javascript. It lots of examples and stuff that you could use/change for your own site. Of course I can't find this... :(
But I did a quick search and found this site:
http://www.scriptsearch.com/
Check it out and let me know if it's any good!
Konoko
Nuvali
07-19-2001, 04:41 PM
Whoo! Aerick! You're treading in some tricky territory, now, man! I'm not sure you can change the number of columns and rows in a table, on-the-fly-client-side. I'm assuming the server-side route (via perl, or php, or asp, etc.) is out of the question for you, but that *would* be the ideal way to go.
The solution might exist in layering, and/or dhtml, but again...spooky stuff, because it's hard to guarantee that the user's browser will "like" it.
I'll talk to a couple people tomorrow and see if they know of anything (pending someone doesn't give you an answer tonight).
Nuvali
07-19-2001, 04:50 PM
If you're talking about just holding fields and their values, then you can keep all of that in a javascript array. The crappy part (actually the "crappiest" part--there are several crappy parts) about that deal, is if you don't store that array in a database (or text file or whatever), and then pull that array back into the page at a later time, you *will* loose state (i.e. it's bye-bye).
Althus
07-19-2001, 07:59 PM
Having had to recently learn ASP, I'd say that there's a greater chance of DHTML working ;)
ASP is, as far as I'm concerned, entirely useless in any situation in which there is an alternative available. (Yet so many people use it. Masochism is far more common these days, it seems.)
Kiriel
07-19-2001, 08:23 PM
People use ASP because of Microsoft brainwashing. Trust me- PHP, Perl, Java, any of it is better than ASP.
Nuvali
07-19-2001, 09:56 PM
lol... I love talking shop, but unless Aerick has permission to run server-side stuff, then it really doesn't matter how obtuse Microsoft's ASP vs. open-source PHP, is.
And now I'm feeling like I'm at one of those company picnics. Althus, Kiriel, if you're going to make any kind of case for javascript (which is a brother to DHTML) or perl, then surely you remember that javascript and perl can be a foundation on the back-end for asp, as well as vbscript (which is far more literate when it comes to computations or financial instructions than javascript or jscript--jscript being Microsoft's lame attempt at a syntax-reorganization of javascript). But those are scripting languages jammed into the engine block. What we could really talk more about, if you want, is the object-oriented umbrella (i.e. java, fortran, whatever) that is supplied by ASP+ and SOAP vs. the Java and Java2 snafu that is going to light-up the entire industry.
I like PHP. I like ASP. I like Java. They are tools in the tool belt. Sometimes you need a hammer. And sometimes you need vice-grips.
But...come on...the thought that Microsoft is "evil," for all sorts of ambiguous reasons, is about as fashionable as burning fur coats. It does *not* mean that mink is all that bad to wear.
Again... back on topic: if Aerick is stuck with client-side capability, then it's a waste of his time to even think about this stuff. He only has a couple of options: javascript and ActiveX. And yes... avoid ActiveX! It's a Microsoft child that very few companies interpreted correctly besides Microsoft, not to mention the ridiculous number of security holes in it.
And I'm sorry, Aerick, because that probably didn't help worth a damn.
Kiriel
07-19-2001, 10:16 PM
Actually, my complaint was about ASP, not VBScript (which is annoying for different reasons). We used ASP at a previous company I was at. It was extremely fragile and hard to debug and we had the hardest time keeping the server from freaking out. We were constantly having to restart the server to keep our site up. But let's not get into a religious war- I'm sure ASP doesn't suck as much if someone with clue cares for it (that said, I've not been able to break my server with PHP).
If at all possible Aerick- I recommend some type of server side scripting. If not possible- I think you're going to end up using document.write a lot. I tend to avoid Javascript though- I find it extremely frustrating, so I wish you luck.
Aerick
07-20-2001, 04:09 AM
\action blinks in a dazed state
........
So, um, I could document.write it all into existence? That was kind of my plan, except I couldn't get it to work (quite possible due to a lack of HTMLing).
Is there a difference between write and writeln?
And yes, it all has to be client-side.
Sargon
07-20-2001, 05:03 AM
Hi!
The difference between 'write' and 'writeln' is that the latter adds a carriage return.
You can't use document.write* to change the look of a webpage, which is fully rendered. To drastically change the layout of a page on the client-side (and adding rows/col to a table is drastic in this respect) you either have to use layers, which kinda work in Netscape and prolly not in other browsers, or some silly feature which works under IE but not in other browsers. :)
ActiveX would also be something on the client side, but - although I don't know what could be achieved with it - if you want to code something which runs under Windows only, create a real GUI. :) [ie. not HTML]
If it's ok for your application to make a client-server-client roundtrip the most straightforward solution would be:
1. Present a simple form where the user can specify the number of desired cols/rows.
2. By clicking the submit button of the form it will be sent to the server, where it will be processed by some kind of CGI. (be it SOAP, pure-CGI, php, you name it)
3. The server sends back a HTML-page with the desired number of cols/rows.
Summary:
1. If you're allowed to do prepare the desired page on the server side, it's rather trivial (not really important what technology you'd use, but php pops into my mind)
2. If you have to do everything on the client side, you can shoot yourself (that includes ActiveX, layers, you name it ;)
HWC Sargon
Aerick
07-20-2001, 05:53 AM
So it looks like today, I'll dick around, goofing off on the computer. Then, Monday, I'll explain that it can't be done, show them this as proof, and go chat with the other computer guy for a while. Then break out what I had already done, which was virtually complete at the beginning of this week, before the new idea hit, finish it up, show it off, and be done.
Splendid, anyone need anything done today? ;)
-HWC Aerick
Aerick
07-20-2001, 05:54 AM
Oh, err, oops. With that post on, I probably SHOULDN"T use this as evidence. Nuts. =)
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.