473,396 Members | 1,871 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

help with form auto update

Hi,

I would like to update my form after something is intered into a textbox in
real time.

For instance, Box A has a blank entry and I enter in 5. Box B I enter in 6
so in Box C it should automatically give me 11 (if the code I put in is to
add box A and B). Then in Box D I put in 3 (say to subtract from A and B
combined) so then Box C adjusts to give me 8.

Don't worry about the math as that's all taken care of it, I just need to be
able to know how to update on the fly like this.

Any help in trying to accomplish this would be appreciated.

Thanks in advance!
john
Jan 4 '06 #1
1 2240
John wrote:
Hi,

I would like to update my form after something is intered into a textbox in
real time.

For instance, Box A has a blank entry and I enter in 5. Box B I enter in 6
so in Box C it should automatically give me 11 (if the code I put in is to
add box A and B). Then in Box D I put in 3 (say to subtract from A and B
combined) so then Box C adjusts to give me 8.

Don't worry about the math as that's all taken care of it, I just need to be
able to know how to update on the fly like this.

Any help in trying to accomplish this would be appreciated.

Thanks in advance!
john
Add events to the input element onkeyup attribute. A trivial example
follows:
<script type="text/javascript">
function addItems(tot)
{
var t, f=tot.form;
var s=0;
for (var i=1, len=arguments.length; i<len; ++i){
t = f[arguments[i]];
if (t.value && !isNaN(t.value)){
s += +t.value;
}
}
tot.value = s;
}

</script>

<form action="">
<input type="text" name="inp-01"
onkeyup="addItems(this.form['inp-03'],'inp-01','inp-02');"+ <input type="text" name="inp-02"
onkeyup="addItems(this.form['inp-03'],'inp-01','inp-02');"= <input type="text" name="inp-03"
onkeyup="addItems(this.form['inp-03'],'inp-01','inp-02');"

</form>

--
Rob
Jan 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Michael Rodriguez | last post by:
I have what I believe to be a typical master/detail scenario. I know how to use a transaction on the sql updates, but what about any dataset merges? My scenario goes like this: // call data...
4
by: Matt | last post by:
I have the following in a page and I am trying to update a record on the next page but for some reason the form data is not carrying over. Any ideas why? <form name=nxtlupdate method=post...
0
by: Sam | last post by:
Folks.. I am trying to use a Simple form with 3 fields from SQL NorthWind Database (Order Details Table with 3 Fields. - OrderId, ProductId and Unit Price). The Field Unit Price has a data...
17
by: so many sites so little time | last post by:
all right so the script is pretty simple it goes it retrives what the id of the post is and it lets you edit it well no it doesnt. now if you go to www.kirewire.com/pp2/index/php you will see a...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
2
by: rpjd | last post by:
I am trying to submit entries in a form to a database. I am using " within my submission form and $_POST I am getting the connection to the database but I my script is not executing,...
19
peeaurjee
by: peeaurjee | last post by:
hi Its my first post to e-scripts. i hope i will get help soon for my problem. I have 2 tables Employees and the second one is Training. The relation between them is 1 to 1. i have...
3
by: burger54 | last post by:
I have a form, lets call it form A, that displays a list of projects that need completed. The record source for form A is a simple select Query. when you click on a record it shows a detailed...
3
by: pavani1 | last post by:
Hi, After signin in my home page one button is there.i,e update profile.for that i wrote the below code but it will not work.plz tell that what's the problem in my code. <?php // Connect...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.