PC Review


Reply
Thread Tools Rate Thread

add up data in a form

 
 
Eric Willems
Guest
Posts: n/a
 
      12th Jul 2005
I want to add up data in a form but I don't know how to do that. For
example: if some wants to order 1 time product X and 2 times product Y, I
want to present a total price before the submit of the form. The form/data
will be presented in an E-mail to me. I use frontpage.

Regards


 
Reply With Quote
 
 
 
 
Trevor L.
Guest
Posts: n/a
 
      12th Jul 2005
Yes, you can do it, but in Javascript.

It is not difficult, but I would need a bit of time to write and test it
(about 10minutes) . I am off to shops now - here in Australia. If you are on
the other side of the world (e.g.USA), I can probably answer while you are
asleep.

Not sure about the form to EMail bit. I have seen discussions on this but
haven't tried it myself. (I am not a business peson, just an amateur web
junkie)
--
Cheers,
Trevor L., WIP (Web Interested Person)
Website: http://tandcl.homemail.com.au

Eric Willems wrote:
> I want to add up data in a form but I don't know how to do that. For
> example: if some wants to order 1 time product X and 2 times product
> Y, I want to present a total price before the submit of the form. The
> form/data will be presented in an E-mail to me. I use frontpage.
>
> Regards



 
Reply With Quote
 
Trevor L.
Guest
Posts: n/a
 
      12th Jul 2005
I have tried but I can't do it.

I think you need code like this:
<html>
<head>
<script type="text/javascript">
function validate()
{x=document.myForm
x.total.value = +x.amount.value*x.cost.value}
</script>
</head>
<body>
<form name="myForm" action="" onsubmit="validate()">
Enter Amount:<input type="text" name="amount" size="20" value=""><br>
Enter Cost: <input type="text" name="cost" size="20" readonly=readonly
value= "2.00"><br>
Total Value: <input type="text" name="total" size="20" value=""><br>
<input type="submit" value="Submit">
</form>
</body>
</html>

But the problem is that neither the box "amount" nor "total" retain the
value. During the execution of the code, the values are there (as tested by
alerts) but on completion of the function, both boxes are blank.

I am confused.
I can't help you and I can't understand what is wrong.

Can someone help me too please.
--
Cheers,
Trevor L., WIP (Web Interested Person)
Website: http://tandcl.homemail.com.au

Trevor L. wrote:
> Yes, you can do it, but in Javascript.
>
> It is not difficult, but I would need a bit of time to write and test
> it (about 10minutes) . I am off to shops now - here in Australia. If
> you are on the other side of the world (e.g.USA), I can probably
> answer while you are asleep.
>
> Not sure about the form to EMail bit. I have seen discussions on this
> but haven't tried it myself. (I am not a business peson, just an
> amateur web junkie)
> --
> Cheers,
> Trevor L., WIP (Web Interested Person)
> Website: http://tandcl.homemail.com.au
>
> Eric Willems wrote:
>> I want to add up data in a form but I don't know how to do that. For
>> example: if some wants to order 1 time product X and 2 times product
>> Y, I want to present a total price before the submit of the form. The
>> form/data will be presented in an E-mail to me. I use frontpage.
>>
>> Regards



 
Reply With Quote
 
Stefan B Rusynko
Guest
Posts: n/a
 
      12th Jul 2005
See http://irt.org/script/form.htm#6

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________


"Eric Willems" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
|I want to add up data in a form but I don't know how to do that. For
| example: if some wants to order 1 time product X and 2 times product Y, I
| want to present a total price before the submit of the form. The form/data
| will be presented in an E-mail to me. I use frontpage.
|
| Regards
|
|


 
Reply With Quote
 
MD Websunlimited
Guest
Posts: n/a
 
      12th Jul 2005
Hi Eric,

Take a look at Form Calculator
Wish you could calculate form field totals? Well, you can with Form Calculator
http://www.websunlimited.com/order/P...c/formcalc.htm

--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible

"Eric Willems" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
>I want to add up data in a form but I don't know how to do that. For example: if some wants to order 1 time product X and 2 times
>product Y, I want to present a total price before the submit of the form. The form/data will be presented in an E-mail to me. I use
>frontpage.
>
> Regards
>



 
Reply With Quote
 
Trevor L.
Guest
Posts: n/a
 
      13th Jul 2005
With a bit of guidance from other posts here is my revised code

<html>
<head>
<script type="text/javascript">
function addup()
{
x=document.myForm
x.total.value = +x.amount.value*x.cost.value
alert(x.total.value)
}
</script>
</head>
<body>
<form name="myForm" action="">
Enter Amount:<input type="text" name="amount" size="20" value=""><br>
Enter Cost: <input type="text" name="cost" size="20" readonly=readonly
value= "2.00"><br>
Total Value: <input type="text" name="total" size="20" value=""><br>
<input type="button" value="Add" onclick = "addup()">
</form>
</body>
</html>

It may be better to have a different event to trigger the addup function.
e.g. tabbing out of a field. You would also need to modify this for more
than one amount and value
--
Cheers,
Trevor L., WIP (Web Interested Person)
Website: http://tandcl.homemail.com.au

Trevor L. wrote:
> I have tried but I can't do it.
>
> I think you need code like this:
> <html>
> <head>
> <script type="text/javascript">
> function validate()
> {x=document.myForm
> x.total.value = +x.amount.value*x.cost.value}
> </script>
> </head>
> <body>
> <form name="myForm" action="" onsubmit="validate()">
> Enter Amount:<input type="text" name="amount" size="20" value=""><br>
> Enter Cost: <input type="text" name="cost" size="20"
> readonly=readonly value= "2.00"><br>
> Total Value: <input type="text" name="total" size="20" value=""><br>
> <input type="submit" value="Submit">
> </form>
> </body>
> </html>
>
> But the problem is that neither the box "amount" nor "total" retain
> the value. During the execution of the code, the values are there (as
> tested by alerts) but on completion of the function, both boxes are
> blank.
> I am confused.
> I can't help you and I can't understand what is wrong.
>
> Can someone help me too please.
> --
> Cheers,
> Trevor L., WIP (Web Interested Person)
> Website: http://tandcl.homemail.com.au
>
> Trevor L. wrote:
>> Yes, you can do it, but in Javascript.
>>
>> It is not difficult, but I would need a bit of time to write and test
>> it (about 10minutes) . I am off to shops now - here in Australia. If
>> you are on the other side of the world (e.g.USA), I can probably
>> answer while you are asleep.
>>
>> Not sure about the form to EMail bit. I have seen discussions on this
>> but haven't tried it myself. (I am not a business peson, just an
>> amateur web junkie)
>> --
>> Cheers,
>> Trevor L., WIP (Web Interested Person)
>> Website: http://tandcl.homemail.com.au
>>
>> Eric Willems wrote:
>>> I want to add up data in a form but I don't know how to do that. For
>>> example: if some wants to order 1 time product X and 2 times product
>>> Y, I want to present a total price before the submit of the form.
>>> The form/data will be presented in an E-mail to me. I use frontpage.
>>>
>>> Regards



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto-populate data in a form based on data entered in a form mthoms Microsoft Access Forms 1 28th Mar 2008 08:44 PM
How can I refresh data in a calculated field on my main form after sub form data changes? d.barson@btinternet.com Microsoft Access Forms 5 7th Sep 2007 01:01 PM
Create a form in excel so I can enter data using Data>Form =?Utf-8?B?THlubg==?= Microsoft Excel Misc 2 14th Feb 2007 06:35 PM
how to get a data form to fill you own exel sheet (was data-form =?Utf-8?B?ZXJpayB2YW4gYnVpanRlbmVu?= Microsoft Excel Worksheet Functions 2 30th May 2006 05:31 PM
Data Entry Form (similar to default Excel Data>Form) tonydm Microsoft Excel Programming 0 11th Oct 2005 07:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:40 AM.