Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


Order Form (amount selector)



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> JavaScript Forum
View previous topic :: View next topic  
Author Message
laLavatrice



Joined: 23 Apr 2008
Posts: 4

PostPosted: Wed Apr 23, 2008 5:41 pm    Post subject: Order Form (amount selector) Reply with quote

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
Back to top
View user's profile Send private message
laLavatrice



Joined: 23 Apr 2008
Posts: 4

PostPosted: Thu Apr 24, 2008 11:06 am    Post subject: I got-I wish Reply with quote

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
Back to top
View user's profile Send private message
laLavatrice



Joined: 23 Apr 2008
Posts: 4

PostPosted: Wed May 07, 2008 10:55 am    Post subject: More Details... Reply with quote

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

Code:
<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
Back to top
View user's profile Send private message
laLavatrice



Joined: 23 Apr 2008
Posts: 4

PostPosted: Fri May 16, 2008 8:56 am    Post subject: GOT IT! Reply with quote

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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> JavaScript Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap