PDA

View Full Version : Error on simple order form


chrisinoz
05-07-2005, 12:06 AM
Hi All

I am trying to get this simple order form to send through a value of eg 25.00 but it keeps sending through .25

Ideas anyone.

Form is here - mockup - just testing functionality

http://www.integrinet.com.au/coffee/ord.php

Screen shot of problem is here.

http://www.integrinet.com.au/coffee/form.php

You will see the demo realtime third party page showing 25.95 - should be 2595. Assume Eway is correct as I have tried other forms and they all work fine for other clients

Here is the short script for it.

Thanks for any help.

Client wants to go live early next week.

Cheers

Chris

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<title>Contact the Coffee Training Centre</title>
<SCRIPT language=JavaScript>
<!--
function CalculateTotals(){
f=document.orderform;
f.total1.value=parseInt(f.qty1.value)*50.00;
f.total2.value=parseInt(f.qty2.value)*295.00;
f.total3.value=parseInt(f.qty3.value)*395.00;
f.total4.value=parseInt(f.qty4.value)*750.00;
f.grandtotal.value=parseInt(f.total1.value)
+parseInt(f.total2.value)
+parseInt(f.total3.value)
+parseInt(f.total4.value);}
//-->
</SCRIPT>
</head>

<FORM name=orderform action=preprocess.php method=post>
<TABLE border=3>
<TBODY>
<TR>
<TH>Qty</TH>
<TH>Part #</TH>
<TH>Description</TH>
<TH>Price</TH>
<TH>Total</TH></TR>
<TR>
<TD>
<select name=qty1 onblur=CalculateTotals()>
<option value=0>0</option>
<option value=1>1</option>
<option value=2>2</option>
</select><!-- <INPUT size=3 name=qty1> --></TD>
<TD>25791</TD>
<TD>Product name</TD>
<TD align=right>$50</TD>
<TD><INPUT
onfocus="document.orderform.qty2.select();
document.orderform.qty2.focus();"
size=7 name=total1></TD></TR>
<TR>
<TD><INPUT onblur=CalculateTotals() size=3 name=qty2></TD>
<TD>17557</TD>
<TD>Product name</TD>
<TD align=right>$295</TD>
<TD><INPUT
onfocus="document.orderform.qty3.select();
document.orderform.qty3.focus();"
size=7 name=total2></TD></TR>
<TR>
<TD><INPUT onblur=CalculateTotals() size=3 name=qty3></TD>
<TD>98754</TD>
<TD>Product name</TD>
<TD align=right>$395</TD>
<TD><INPUT
onfocus="document.orderform.qty4.select();
document.orderform.qty4.focus();"
size=7 name=total3></TD></TR>
<TR>
<TD><INPUT onblur=CalculateTotals() size=3 name=qty4></TD>
<TD>47594</TD>
<TD>Product name</TD>
<TD align=right>$750</TD>
<TD><INPUT
onfocus="document.orderform.qty1.select();
document.orderform.qty1.focus();"
size=7 name=total4></TD></TR>
<TR>
<TD></TD>
<TD></TD>
<TD></TD>
<TD align=right><B>GRAND TOTAL:</B></TD>
<TD><INPUT
onfocus="document.orderform.qty1.select();
document.orderform.qty1.focus();"
size=7 name=grandtotal></TD></TR></TBODY></TABLE><BR>


<SCRIPT language=JavaScript>
<!--
f=document.orderform;
f.qty1.value=0; f.qty2.value=0;
f.qty3.value=0; f.qty4.value=0;
f.total1.value=0; f.total2.value=0;
f.total3.value=0; f.total4.value=0;
f.grandtotal.value=0;
//-->
</SCRIPT>

vwphillips
05-07-2005, 12:31 AM
dont know why it divides by 100 (not enough info in posed code)

but

http://homepage.ntlworld.com/vwphillips//FormCompendium/FormCompendium.htm

f3
may be of interest for keyup totaling rather than onblur

chrisinoz
05-07-2005, 05:52 AM
Thanks VW

I just found the error in my preprocess.php - was not *100 my total.

I will check out though the keyup option

Cheers

Chris

chrisinoz
05-07-2005, 06:12 AM
Hey VW

Bookmarked your form page. Looks very helpful.

My client has a specific that on some items you can only but one item hence the need for a drop down with only the value of 1 being able to be selected.

OnBlur works for this.

I tried a Select box and a checkbox on your script but it does not owrk.

Is there a workaround to allow for only Quantity=1 to be made for some items?

Thanks

Chris

vwphillips
05-07-2005, 09:02 AM
I have modified my script so a checkbox can be used for a single quantity

see

http://www.vicsjavascripts.org.uk/FormCompendium/f3X.htm

a radio can be used if there is a hidden second radio somewhere in the form

l