How to calculate a numeric entry in a form

# Thread: How to calculate a numeric entry in a form

1. Osney Guest

## How to calculate a numeric entry in a form

Hi there<BR><BR>I&#039;m building a registration form.<BR><BR>I&#039;ve got a ticket field which allow the user to enter a numeric value between 1-99. if the user enter a number, I want it to automatically calculate the price..e.g. user enter 2, so 2 x 45 =90. so 90 appears down below.<BR><BR>is there anyway you can do this using VBscript/asp?<BR><BR>Regards<BR>Osney.

2. Senior Member
Join Date
Dec 1969
Posts
19,082

## RE: How to calculate a numeric entry in a form

basic math is one of the simplest operations you can do in ASP - it&#039;s very very easy indeed. can i suggest you look at a beginners tutorial - see www.aspin.com<BR><BR>j

3. Osney Guest

## RE: How to calculate a numeric entry in a form

Hi<BR><BR>I know basic maths is the simplest in ASP/vb. You misunderstood my question.<BR><BR>My question say &#039;how to automatcially calculate on the fly when a value is entered into the box&#039;<BR><BR>Osney

4. Member
Join Date
Dec 1969
Posts
79

## RE: How to calculate a numeric entry in a form

You mean client side calculation<BR><BR>If yes<BR>you can javascript to show that calculated values like that<BR><BR>&#060;input type=text value="" name=x onchange="calljavascript()"&#062;<BR><BR><BR>funct ion calljavascript()<BR>{<BR>d.f.f_name=d.f.f_name.val ue*45<BR>}<BR>}

5. Senior Member
Join Date
Dec 1969
Posts
19,082

## in that case

use client-side javascript from the textbox&#039;s onchange event<BR><BR>j

6. Osney Guest

## RE: in that case

&nbsp;<BR>.. but can it be done in VBscript/asp?

7. Osney Guest

## RE: How to calculate a numeric entry in a form

hi<BR><BR>I want 2 fields that calculate the answer in another box, but I get an object error:<BR><BR>Here&#039;s my code:<BR><BR> &#060;tr align="left" valign="top"&#062; <BR> &#060;td colspan="3" height="42"&#062; <BR> &#060;p class="body"&#062;I am an IRNA member and I wish to book <BR> &#060;input type="text" name="membertickets" size="5" onchange="this.form.total.value=this.form.nonmembe rtickets+this.value*45" maxlength="5"&#062; <BR> tickets at £45 per person&#060;/p&#062;<BR> &#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr align="left" valign="top"&#062; <BR> &#060;td colspan="3" height="32"&#062; <BR> &#060;p class="body"&#062;I am not an IRNA member and I wish to book <BR> &#060;input type="text" name="nonmembertickets" size="5" onchange="this.form.total.value=this.form.memberti ckets+this.value*45" maxlength="5"&#062;<BR> tickets at £80 per person&#060;/p&#062;<BR> &#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr align="left" valign="top"&#062; <BR> &#060;td colspan="3" height="32"&#062; <BR> &#060;p class="body"&#062;Click here to Calculate Total.Total: &pound;<BR> &#060;input type="text" name="total" size="5" maxlength="5"&#062;<BR> &#060;/p&#062;<BR> &#060;/td&#062;<BR> &#060;/tr&#062;<BR><BR>any ideas?<BR><BR>Thanks<BR>Oz

8. Senior Member
Join Date
Dec 1969
Posts
19,082

## RE: in that case

only by submitting the form. I thought you didn&#039;t want to do that?<BR><BR>j

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•