Processing values from Form

R

Rosco

Is there any way to take the value from a form field and do a simple
mathematical function on it and display the result on the confirmation
page?

I want to multiply a number that is entered into the form. I'm using a
custom confirmation page (processed by shtml.exe) and the number can be
displayed using "Confirmation Field". The confirmation field is
"Number", so can I use javascript or some other method to display the
result of "Number" x 5.95?

Or does the whole form have to be written in javascript for something
like that?
 
K

Kevin Spencer

Hi Rosco,

JavaScript is client-side. It is used for manipulating HTML in the page. A
form posts to the server, where there is no JavaScript. On the server, an
ISAPI (Internet Server Application Programming Interface) handles the form.
So, assuming that there is no form handler app on the server which can do
this, you would need to write your own custom server-side form handler,
using whatever server-side technologies are available on your server.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
R

Rosco

Hi Kevin,

Thanks for the reply. Using ISAPI seems very complicated. I should be
able to do the calculation before sending the form. Can I take the
value entered in the form and multiply it by 5.95 before sending the
form to the confirmation page? How do I access this variable?

Ross
 
T

Thomas A. Rowe

Yes, you can do this using JavaScript. Do a search on the internet for JavaScript Form Calculations.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
S

Stefan B Rusynko

In your form add a hidden form field to do the calc

In the form, right click | Form Properties | Advanced | Add | Name the field (say: Result) and give it a value (say 0). Make sure
your field named "Number" is set w/ validation as a Numerical field
To do the math in the submit button add an onclick event handler

onclick="this.form.Result.value=parseInt(this.form.Number.value)*5.95;return true;"







| Is there any way to take the value from a form field and do a simple
| mathematical function on it and display the result on the confirmation
| page?
|
| I want to multiply a number that is entered into the form. I'm using a
| custom confirmation page (processed by shtml.exe) and the number can be
| displayed using "Confirmation Field". The confirmation field is
| "Number", so can I use javascript or some other method to display the
| result of "Number" x 5.95?
|
| Or does the whole form have to be written in javascript for something
| like that?
 
K

Kevin Spencer

Just follow Tom's or Stefan's advice. Use a hidden form field and do the
calculation in it.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
R

Rosco

Thanks Stefan, this looks exactly like what I need. I also found a CGI
script that seems to do the job.

Thanks to all for your advice.

Ross
 
Top