Java Scripts.....need help

KH85

Senior member
Jun 24, 2002
673
0
0
Hi all

i am currently a student and i have been asked to make a web site with java script on, this site must have a form to fill in so you can order a product.

i am thinking of what java to put in the site

could i use java to make a loggin script? if so could you supply me with sample script (NOT TO COMPLICATED) also could i use java to take the information from the form ie:

Name and Address and display it on a another site to say the order has been processed and will be soon dispatched? if yes could i have some sample code again?!? if you could help me it would be great.

thanks in advance

Couger / KHGamez

I Love you all (only the ones who help me :D)

 

eklass

Golden Member
Mar 19, 2001
1,218
0
0
a) java is not javascript. javascrip is not java... don't confuse the two

b) your best net for a login script is going to be a server-side language such as PHP... it's free, easy to use, and there's gobs of tutorials everywhere

c) you'll want to investigate something called sessions. read a tutorial, they're there to help you

d) php.net
devshed.com
phpbuilder.com
phpfreaks.com
zend.com
 

KH85

Senior member
Jun 24, 2002
673
0
0
sorry..

I am currently learning PHP (on my own - Not being tought) BUT this site NEEDS to have Java / Javascript on.....what could use java for on this site?

Thanks in advance
 

calpha

Golden Member
Mar 7, 2001
1,287
0
0
It sounds like you're a little confused.

A login script as is already said, is best done w/ a server side technology. (yes, I know you can run SS-JScripts, but I'm not talking about those right now).

Embedding Java into a webpage is done primarily in one of two ways:
Applets
JSP (Java Server Pages).

IMO, if you want to create a form with a login/product order....the simplest way to do it is via JSP. Unfortunately, in order to use JSP, you have to do some initial setup of a web server (ie Tomcat, or Apache....never used it on IE...why would you???) but there's plenty of web faqs on how to do it.

If you were to code an applet of it......then you'd not need a web server to set it up.

BUT this site NEEDS to have Java / Javascript on
Make up your mind. Does this mean Java AND Javascript, or Java OR Javascript???

If you need only one or the other....then as far as completing the exercise to meet your said requirements, you could do it in javascript in about 5 minutes......
 

KH85

Senior member
Jun 24, 2002
673
0
0
i am a litle confused about it?!? that is why a asked here, but as i am cunfused i made you all confused. i will talk to my teacher about it see if she wants JAVA or JAVASCRIPT. thanks with your help so far :)
 

stndn

Golden Member
Mar 10, 2001
1,886
0
0
i know we're all confused, but i'm thinking you'll need javascript instead of java
here's how it usually works:

1. create a website (plain html) that has forms where user can enter their name, make product selection, specify the quantity, etc.

2. add javascript code to the page (from step 1) where user will be shown their order total when they click on a button

3. if the user is satisfied with their order, click the order button, and their order will be processed by cgi/php/whatever script that is running on the server side

4. display the result of the order on a separate page, after the user confirm their order from step 3

well, at least that's how i believe things work ...
i don't really have any idea how java would be used here, unless you create your order form (step 1 and 2) on a javascript applet, which seems to be a lot of work just for simple order form...

but yeah, first step would be to make sure whether your teacher wants java or javascript...
and also, ask him what he wants you to do once you calculate the order total and stuffs....
 

KH85

Senior member
Jun 24, 2002
673
0
0
yep you have got it :)

Exactly what i need :)

but now the coding :( dont really know what the coding will be (btw i am using Dreamweaver MX if that helps) if you could give me an example of the code it would be good :)

Thanks again
 

stndn

Golden Member
Mar 10, 2001
1,886
0
0
for simple javascript examples related to forms, you can always refer to w3schools

of course, there are a lot of pre-made scripts for form validations on the web...
but i'm sure that's not what you're looking for, right? ;)

anyways, i never used dreamweaver to create web pages...
but as long as you can type some JS functions in there, you should be okay...

here's some hints:
- use functions for validating the form fields, so your code can be reused
- i assume you just started learning JS for forms... i suggest you don't create generic functions that is used to validate all the form fields (which is what most functions out there on the web are made of)...

- make one function for each form widgets (ie: one function to validate text, one function to validate radio button, etc). that will make understanding easier
- on netscape/mozilla, you can type javascript: (with colon at the end) on the location bar (where you put url's) for debugging... this is very useful if you encounter javascript errors and want to know what causes the errors....

have fun :)
 

KH85

Senior member
Jun 24, 2002
673
0
0
Thanks alot

ill be sure to have a look at that site to have a look at some example scripts :)