Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent Help Please!!

Status
Not open for further replies.

tanujm

MIS
Mar 20, 2003
12
0
0
AU
Hi All,

I am doing a website and I need some help with Javascript - as I am creating an online Order form which can be filled by the customer and comes to me as email. I cannot use CGI as our server does not support CGI on our hosting plan.

Purpose of this form is to enable users to select products and associated quantities along with their contact details and send it to us via HTML Post function.

I need to use Javascript to provide a running total of the products ordered, calculate the GST Tax component (10%) and the final total.

The form looks like this:


DVD's & VCD's that are currently for sale

DVD1: $300

DVD2 : $250

DVD3: $223

VCD1: $123

VCD2: $212

Optional Extras which can be brought

DVD/CD without the Manuals but with Glossy pics of facilities in video : $15 extra / DVD

DVD/CD with the Manuals and with Glossy pics of facilities in video : $23 extra / DVD

The form would then have the standard input area for users to provide their name phone address etc.

Calculated Fields include : (this should provide the customer with name of fields which are being calculated)

Total for Order

GST (10%)

Grand Total (Total + GST)

I have created a form and managed to validate the fields but i m having trouble doing the running total, gst and the grand total

If someone can help me with the Javascipt to do these totals I would be greatly obliged.

Thanks,

Tanuj
 
It's a bit hard to help you do your totals since you haven't told us how the form is structured... Checkboxes? Selects? Text Boxes?

At any rate... adding numbers together is a fairly simple task. Just make sure you use parseFloat to get the numeric value otherwise you'll be concatenating strings rather than adding numbers.

My more immediate concern would be what in tarnation you might be going to Post to if your host doesn't support CGI?

That and what sort of DVD might possibly cost three-hundred bucks.

[sub]Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
[/sub]
 
Hi dwarfthrower

Thanks for your reply.

The form is structured as below:

<select size=&quot;1&quot; name=&quot;Disctype&quot;>
<option></option>
<option>DVD1</option>
<option>DVD2</option>
<option>DVD3</option>
<option>VCD1</option>
<option>VCD2</option>
</select></td>

<select size=&quot;1&quot; name=&quot;Option type&quot;>
<option></option>
<option>No Manual - only glossy pics $15</option>
<option>Manual & glossy Pics $23</option>
</select></td>

I am having trouble doing the totals. Could you suggest a simple way to do it.

The DVD's are based on Video shoots of Retirement homes and have a lot of analysis and targeted at Architects & Developers - hence the price.

Thanks

Tanuj
 
Just go to this thread:
Running total from multipe select -HELP!(thread216-657766)

It's everything you are trying to do + bells :)

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
>> I am having trouble doing the totals. Could you suggest a simple way to do it.

Yep, start by adding the values into the options:
Code:
<select size=&quot;1&quot; name=&quot;Disctype&quot;>
        <option value=&quot;0&quot;></option>
        <option value=&quot;300&quot;>DVD1</option>
        <option value=&quot;250&quot;>DVD2</option>
        <option value=&quot;223&quot;>DVD3</option>
        <option value=&quot;123&quot;>VCD1</option>
        <option value=&quot;212&quot;>VCD2</option>
        </select></td>

<select size=&quot;1&quot; name=&quot;Option type&quot;>
        <option value=&quot;0&quot;></option>
        <option value=&quot;15&quot;>No Manual - only glossy pics $15</option>
        <option value=&quot;23&quot;>Manual & glossy Pics $23</option>
        </select></td>


Then you can access the value property to get the values. After that, as clarkin said... anything you need to know about adding up select boxes is in that thread.

You GST component will need to be calculated differently based on whether the prices you're quoting are GST inclusive (ie GST is 1/11th of the total and not added on) or GST exclusive (ie GST is 1/10th of the total and added on to give the grand total).

Also, you mentioned quantity, but haven't given any indication for how you are handling multiple copies or mulitple items.

[sub]Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
[/sub]
 
Hi dwarfthrower & clarkin

Thanks for all your help.

I m new to Javascript and going by the &quot;Learn Javascript in 24 hrs&quot; book.

Can you or anyone else help me with the actual code - as I have no idea of the actual code for doing running totals.

2 More things I need help on is:

a) Instead of a select list for DVD's - how do i use checkboxes - so ppl can order more then 1 type of disc.

b) I would like to have a quantity option for the manuals & pics - so someone - if they want to can order 2 sets of pics - so I would like a user fillable quantity box which has a default of 1 set - and if someone increases the quantity the price updates itself.

I greatly appreciate the help from you guys and time you are spending - really appreciate the help.

Thanks.

Tanuj




 
>> Can you or anyone else help me with the actual code - as I have no idea of the actual code for doing running totals.

There is plenty of code in the thread clarking linked to. Is there something in particular that you are not understanding?

>> Instead of a select list for DVD's - how do i use checkboxes - so ppl can order more then 1 type of disc
Code:
<input type=&quot;checkbox&quot; id=&quot;Disc1&quot; name=&quot;Disc1&quot;  value=&quot;300&quot;>DVD1
<input type=&quot;checkbox&quot; id=&quot;Disc2&quot; name=&quot;Disc2&quot;  value=&quot;250&quot;>DVD2
<input type=&quot;checkbox&quot; id=&quot;Disc3&quot; name=&quot;Disc3&quot;  value=&quot;223&quot;>DVD3
...
...

You would also need some input boxes (type=&quot;text&quot; for people to enter the quantity they were after, as you mentioned for the manual.


[sub]Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
[/sub]
 
Hi dwarfthrower

Thansk for the help. I have managed to do the DVD selection part and the total is appearing. Thanks

Now i need a bit more help :) please.

I still dont know what code to use so that people can order more the 1 of the &quot;no manuals - only pics&quot; or &quot; manual and pics&quot;.

I have created a text input box where user can type the quantity - I dont know how to calulate the price * quantity and display it.

Also, need help with code which calulates 10% of the Total price(of discs + manuals and which updates automatically depending on selection) and shows the new value (total price + 10%).

To make it less confusing:

I needed:

1 box to calculate DVD/VCD prices - That I managed to do.

1 box to calculate the manual/no manual option - based on quantity provided by user

1 box to calucalte the total of the above two boxes and this box should add 10% to the toatl of the above 2 boxes.


Please can you help me with the last 2 boxes. I really appreciate your help.

Thanks,

Tanuj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top