It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Order Form (amount selector)

Order Form (amount selector)

Postby laLavatrice on Wed Apr 23, 2008 4:41 pm

Ciao!
Problem with an order form: I've got a product list which opens a report page with grand total and the choosen articles indeed.
Have you already heard it? "Confirmable Order Form" in javascript.internet.com
So far so good.

I want to add an amount selector input (drop-down menu with 1, 2, 3 etc.) in the main page that also should be modify the results (grand totale) table in the second one...

Is there anyone who can help me... Italy seems to be unable.

Thanks
laLavatrice
 
Posts: 4
Joined: Wed Apr 23, 2008 4:30 pm

I got-I wish

Postby laLavatrice on Thu Apr 24, 2008 10:06 am

Here http://www.grupposanlucaonlus.it/public/book.htm
you can find the 2 form versions: what I got and what I wish...
They're working! Therefore if you select one or more articles and push the botton "ACQUISTA" (BUY), you'll get the second page (the confirmation page, conferma-ordine.htm) with the resume table and the choosen articles.

My goal is: add the quantity selector value to the script (you can see it in the I-wish-table) and automatic update the grand total...

Sorry... I Know I ask you much... (maybe TOO much)

However thanks
Pino
laLavatrice
 
Posts: 4
Joined: Wed Apr 23, 2008 4:30 pm

More Details...

Postby laLavatrice on Wed May 07, 2008 9:55 am

For many who want to work on my script...

Code: Select all
<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function decodeString() {
valNum = new Array();
valData = new Array();
var string, length, dataCount, orderData, grandTotal;
string = "" + unescape(location.search);
string = string.substring(1,string.length);
length = location.search.length;
orderData = "";
dataCount = 1;
for (var c = 0; c < string.length; c++)
if (string.charAt(c).indexOf("&") != -1) dataCount++;

orderData = "<table border=0 width='400px' cellpadding='2px' cellspacing='5px'>";
orderData += "<tr bgcolor='#CCCCCC'><td><div id='intestazione'>Item</div></td><td><div id='intestazione'>descrizione</div></td><td><div id='intestazione'>spesa</div></td></tr>";
grandTotal = 0;
for (var i = 0; i < dataCount; i++)
{
valNum[i] = string.substring(0,string.indexOf("="));
string = string.substring(string.indexOf("=")+1,string.length);
if (i == dataCount-1) valData[i] = string;
else valData[i] = string.substring(0,string.indexOf("&"));
ampd = valData[i].indexOf("&");
pipe = valData[i].indexOf("-");
star = valData[i].indexOf("*");
line = valData[i].indexOf("$");
itemnum = string.substring(0,pipe);
itemdsc = string.substring(pipe+1,star);
itemcst = string.substring(star+1,line);
string = string.substring(ampd+1,string.length);
 
orderData += "<tr>";
orderData += "<input type=hidden name=item" + (i+1) + "codice articolo='" + itemnum + "'>";
orderData += "<input type=hidden name=item" + (i+1) + "articolo='" + itemdsc + "'>";
orderData += "<input type=hidden name=item" + (i+1) + "costo='€" + itemcst + "'>";
orderData += "<td>" + itemnum + "</td>";
orderData += "<td>" + itemdsc + "</td>";
orderData += "<td>" + itemcst + "</td>";
orderData += "</tr>";
grandTotal += parseFloat(parseFloat(itemcst).toFixed(2));
}
orderData += "<tr  bgcolor='#666666'>";
orderData += "<td colspan=2><div id='totale'>TOTALE</div></td><td><div id='totale'>" + grandTotal + "</div></td>";
orderData += "</tr>";
orderData += "<tr>";
orderData += "<td colspan=3 align=center><input type='submit' value='CONFERMA'><input type='button' value='Annulla' onClick='javascript:history.go(-1);'></td>";
orderData += "</tr>";
orderData += "<input type=hidden name=grandtotal value='$" + grandTotal + "'>";
orderData += "</table>";
document.write(orderData);
}
// End -->
</script>


Here http://javascript.internet.com/forms/confirm-order-thanks.htm you can find the original "confirmale order form" source code and here http://javascript.internet.com/forms/confirm-order.htm how it works.

Thanks
laLavatrice
 
Posts: 4
Joined: Wed Apr 23, 2008 4:30 pm

GOT IT!

Postby laLavatrice on Fri May 16, 2008 7:56 am

Thank you all guys for interesting.


You can see here the result: http://www.grupposanlucaonlus.it/book.htm


Feel free to use this script if you want... but don't forget to leave the credits lines inside the code!!

Share Your Knowledge
laLavatrice
 
Posts: 4
Joined: Wed Apr 23, 2008 4:30 pm


Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests