|
-
Apr 2nd, 2004, 10:06 AM
#1
Thread Starter
Addicted Member
Sum of text boxes
I have 4 text boxes in a colmn and a total box at the end. The total box will be the sum of the values in textboxes 1-4. How do I get the total box to sum when alues are added or changed in any of the four boxes?
-
Apr 2nd, 2004, 03:22 PM
#2
Re: Sum of text boxes
Originally posted by realgoldn
I have 4 text boxes in a colmn and a total box at the end. The total box will be the sum of the values in textboxes 1-4. How do I get the total box to sum when alues are added or changed in any of the four boxes?
Use javascript and write a function to AddUP the values of four text box. Use the OnChange event of each text box to update the calculation by calling the AddUP function.
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Apr 2nd, 2004, 03:27 PM
#3
Thread Starter
Addicted Member
Is there a way to have a group name for a group of text boxes. So I can say on change event of the group then call addup() or must I reference each textbox separatly cuase I have over 20 of them.
-
Apr 2nd, 2004, 03:28 PM
#4
Originally posted by realgoldn
Is there a way to have a group name for a group of text boxes. So I can say on change event of the group then call addup() or must I reference each textbox separatly cuase I have over 20 of them.
No you cant group them, it wouldnt be much anyway just an extra line for each text box.
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Apr 13th, 2004, 08:14 AM
#5
Thread Starter
Addicted Member
For some reason it is treating the value as a string not a number becuase the two values I want to add are 200 + 600 which is 800 but it is displau 200600. Help! This is the function!
sub AddUPEQP()
SET Add = document.Addproj
EQPTotal=add.txteqp1.value
EQPTotal=EQPTotal+add.txteqp2.value
add.txtEQP14.value=EQPTotal
end sub
-
Apr 13th, 2004, 08:23 AM
#6
Originally posted by realgoldn
For some reason it is treating the value as a string not a number becuase the two values I want to add are 200 + 600 which is 800 but it is displau 200600. Help! This is the function!
sub AddUPEQP()
SET Add = document.Addproj
EQPTotal=add.txteqp1.value
EQPTotal=EQPTotal+add.txteqp2.value
add.txtEQP14.value=EQPTotal
end sub
Use Val()........
VB Code:
sub AddUPEQP()
SET Add = document.Addproj
EQPTotal=val(add.txteqp1.value)
EQPTotal=EQPTotal+val(add.txteqp2.value)
add.txtEQP14.value=EQPTotal
end sub
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Apr 13th, 2004, 10:29 AM
#7
Thread Starter
Addicted Member
Is it possible to call two different functions on the onchange() like this
onchange(addup(),totalup())??? Becuase I want to add the totals down and across so I need to different functions.
-
Apr 13th, 2004, 10:44 AM
#8
Originally posted by realgoldn
Is it possible to call two different functions on the onchange() like this
onchange(addup(),totalup())??? Becuase I want to add the totals down and across so I need to different functions.
Never tried it, it wouldnt be advised to do so. Have another function which call those to function, and call that function instead.
eg.
function myUpdate()
addup();
totalup()
end function
now simply call myUpdate.
Hope this helps.
Danial
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Apr 13th, 2004, 10:46 AM
#9
Thread Starter
Addicted Member
-
Apr 13th, 2004, 10:47 AM
#10
Originally posted by realgoldn
Thanks!
You are welcome.
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|