PDA

View Full Version : Need help with calculated fields in form



Dig
04-08-2006, 09:04 PM
Here are questions I asked Microsoft

1.) Is there any way to creat a field in a form that calculates without using
ASP in FK2K?

2.) I have a couple of drop downs in a form and was wondering what the
procedure is to be able to allow the user to choose an oblect from one drop
down that would then automatically intsert a code number in another field?

The reply I received is to use Javascript.

But I have no idea how or even where to begin.

Can someone help me with this?

Thanks

Twey
04-08-2006, 09:58 PM
Yes. But you'll have to give us details.
And what is FK2K?

Dig
04-09-2006, 02:55 AM
Yes..FK2K is FrontPage 2000 but only after you have not had any sleep for a long time.

Here is what I have been playing with http://www.jazzkatamps.com/invoice.htm

I would like the user to be able to choose a description and have the correct unit price come up then have it multiply by the qty and place that in the line total box. Lastly adding it all up at the bottom

If the data could then be saved and I could everyso often dump it into a database.

Thanks and look forward to your help.

Twey
04-09-2006, 08:18 AM
If the data could then be saved and I could everyso often dump it into a database.That's not possible with Javascript. The most that can be done is to submit the values to a server-side script that can handle them.
<form action="dbsave.asp" method="post">
<fieldset>
<legend>Ordering Form</legend>
<select onchange="this.form.elements['tprice'].value = parseInt(this.form.elements['qty'].value) * parseFloat(this.value);">
<option value="35.99">A bed</option>
<option value="12.99">A very small chair</option>
</select>
<br>
Quantity: <input type="text" size="1" name="qty">
<br>
Total price:
<input
type="text"
size="4"
name="tprice"
style="
background-color: transparent;
border: 0px none;
"
readonly="readonly"
>
<input type="submit" value="Save">
</fieldset>
</form>Note that the values generated by this script can be edited by the user, and so should not be relied on for anything other than to give the user information.