PDA

View Full Version : javascripiting inside


jmorse00
03-13-2002, 02:58 PM
I want to creat a form that has the usual:

An item , quanitiy, price each, subtotal
etc
etc.

then i want the complete :subtotal of all items
: Sales tax (for CA only)
: S&H
: complete total of all

Now to my question.

Is it possible to insert javascript into the form that will:
1). as soon as you input quanity and price..for it to calculate the subtotal..
2). as it does above..calculate sales tax and put it in the sales tax box...calculate S&H for subtotal of all and put that price in the S&H box
then calculate the complete total.

but then when hit the submit button. it submits like a form to a webaddress that collects forms...not email!

and also..if possilbe a seperate box that will calculate same as above..just minus the sales tax.

is any of this possible?

thanks,
James

steve_ghb
03-13-2002, 03:05 PM
No problem

Use the 'onBlur' event in the textboxes to call javascript functions. e.g. When user leaves either the quantity or price box, the function checks if there is data in both boxes and populates the subtotal, tax, sh boxes with the calculations.

As for the submitting like a form, I don't understand the question. Why wouldn't you be able to use 'form.submit'?

jmorse00
03-13-2002, 03:15 PM
ok thanks...

as for submitting the form...yes you canuse the form.submit

but for the action:htt:/webaddress.com
I have to put hidden fields underneath the form action
so it can log in and post that form in my account..and
then also needs a url page for it to redirect to..

get it?

scoutt
03-13-2002, 03:39 PM
there is a script that I seen that will do just that. but I can't remember where I saw it. and when you do the hidden fields, put them done by you submit btton. it will cause problems later on with the javascript if you keep them up by the form.