1 person found this helpful
OK. Sounds fine.
Is this a question?
First, tell us where your page is on the Internet and we'll help. Second, tell us what kind of server-side code is supported by your host. Is it php? Is it ASP? Is it ColdFusion?
Then we can answer any questions you might have.
just to explain what i require.
The user will select from the dropdown (choose item) where each option has a value. What i need is to be able to calculate the total of all the values and display in the 'total' column.
Yes it is a question.
And may we find out the question?
To reply, we need to see your code PREFERABLY ONLINE
Please upload your test files and post a link.
'how can i get my form to automatically calculate the total of the values selected?'
What do you mean by 'PREFERABLY ONLINE' shall i capy and paste it?
Neither do I understand what you mean by 'upload my test files'..... to what?
Please could you explain, Thanks
Sure thing -
When you upload all the files in question to your online host, we can easily navigate through all your files and dependent code to tell you what's up.
Forms like this are normally submitted to a forms processsing script on your server.
Is this form being submitted to a payment gateway, or is this for display purposes only?
thanks for your patience.
i've uploaded it http://steppedinsilver.com/order.html
this form is for users wishing to pay by cheque. The form must be filled in and then submitted to an email address. If that makes sense?
Yes that makes sense, thanks.
The form will require some scripting to do the calculations.
Sorry to say that is not my strong suit
If no important personal info is being sent (no credit card numbers), you could use a formmail script like the one available at http://www.tectite.com.
1 person found this helpful
HTML alone will not do what you need.
Ask your web host which programming languages your server supports.
Form processing, validation and calculations should be performed with server-side code because it's more reliable than client-side code.
But before you look at scripts, you need to clean up some errors in your form.
- IDs are unique and can be used only one time per page.
- Names/IDs cannot contain spaces and should match each other.
<form id="form1" name="form1">
What does getScore(this) do?
That is where your script would be.
Here's a great primer, assuming you want to use php.
Now a word of warning. If you are selling stuff on the Internet where you might charge a credit card, you absolutely need a security certificate for yoru web server. They cost in the range of $120 to $90 annually.
If all you are doing is having people mail you a check, that is different. And, if you don't want to host a shopping cart, I can recommend PayPal as well as a whole host of other shopping carts.
Much better. Just a couple of things left.
On line 32, your form ID and Name are mismatched:
"theorderform" and "orderform".
I don't know why you have this in your form:
Finally on line 104, you have an opening <label> tag that belongs before the <td> tag on line 103.
thanks so much, i've made those corrections.
is there really no way i can get it to do those calculations. it seems like a really simple task?
this "thing" is not a very simple matter, really. Here's a link to a discussion, where you can get valuable informations:
"osgood_" gave with his very useful and understandable instructions a big support, like a cookbook.
I for my part understood the trick too - after a while -.
I've tried to follow the tutorial below, without sucess.
I have no idea where i am going wrong, any ideas? http://steppedinsilver.com/order.html
<link href="styles/cakeform.css" rel="stylesheet" type="text/css" />
sorry, i dont understand. What is my directory?
Hello respiro (your name?),
I for my part, I prefer to arrange my directories with subdirectories logical organized according to my themes. So it's always easy to keep track. And - among other things - it's also very handy if you have to hold up your images in several sizes.
In MY case this directory is called "htdocs". So far - to a better understanding and to become a little bit more precisely - I have to show you MY structure tree (merely a suggestion) as a submenu of htdocs. Therefore I used a file manager:
On the other hand, you could send us a link to your website in question, where we could let our creativity run riot all together. (Naturally no offense!)
Hans, I think you're going to confuse the poor soul.
/htdocs/ is the standard "root" or starting directory for a Windows/Apache web server. But if you're on a standard Linux/Apache model, you'll find your staring directory to be /public_html/ and on a Windows IIS server, it can be literally anything that you define in Windows.
For organization, everyone is going to roll his or her own, based on their own common sense.
Here's what I see in your code, respiro:
So, if you have a script called "formcalculations.js," and you have it in a /js/ subdirectory (or folder) for organization's sake (which is what Hans and I are recommending), you need to have a call to it in your <head> area thusly:
Then, you need to call that calculation routine in your form. Currently, you're calling nothing:
<form id="orderform" name="orderform" method="post" action="">
See what you have after action= ? It's an empty set of quotes.
You need to solve the math in the form once submitted. So, you can choose to load a new page with the solution like this:
<form id="orderform" name="orderform" method="post" action="answer.html" onsubmit="function getTotal()">
Or you can use the page you have like this:
Then at the top of your form:
<form action="" id="cakeform" onsubmit="return false;">
Then for the "submit" button, do all of the heavy lifting there:
<input type='submit' id='submit' value='Submit' onclick="calculateTotal()" />
Frankly, I'm so used to doing this kind of a thing in php that I'm second-guessing myself here—but I did follow the tutorial that you linked to, respiro and I do understand the logic.
I'm afraid we two, we both are "going to confuse", sorry that I'll smile about it. We always are learning and learning, everyone in his level.
... and what the concerns "an individual behaviour", that's what I meant with my "My" in capital letters.
Here the demo link:
It would be the best way, to copy it into your DW (I did it). And don't worry, in this case it is allowed and even welcomed!
Thanks Hans and Mark,
Are you suggesting that i copy and paste the code into my DW and then adapt to the form i require?
please have a look here, where I made a simple website by using the above named demo:
http://hansgd.de/AdobTest/db/cakeform.html. Please try it by inserting some entries. AND don't fear to copy this source code to see how it works. And here I'll show you MY file structure I used:
Screenshot shows FTP Filezilla.
I've done as you suggested by copying and pasting the code into my DW. I have replaced all the 'cake' entries with the ones i require. This is what i am left with http://www.steppedinsilver.com/orderform.html
I have some questions;
Can i now put the form into a table, if so how?
I still dont have a function that automatically calculates the total cost of the items selected. i.e. I want a total row
How do i set up where the order form information is submitted to?
If i want to alter the appearnace of the form i.e. color, font etc... how should i do this?
So, calculation ought to be done in php. The result should be an order that is emailed to Respiro, or someone who does fulfillment, and we're looking at the need for server-side code and not client-side.
Frankly, he ought to have this hired done.
now at this point you should go back and take a closer look at my answer in position 17. In osgood_'s solution it is possible to form a sum of a plurality of positions. Furthermore it is possible (ie suppliers/company) to send an email with clients specific order.
What concerns to put the form into tables: on principle yes, BUT ...?