DOH! Good call. Since I have you on the line... What can I add to *this* code to allow for null values? If the user accidentally clicks into one of these fields, the alert pops up because the onbBlur event says there must be a value. I have to allow nulls because I have another script that...
I am trying to write a script to make sure that the user enters specific values ( 0.5,1,3,5, or 10) or else get an alert box. I have a script for another field that validates on a range, but I can't seem to modify it to work for *specific* values. Below is the range script, which works fine for...
Sweet. Thanks. I should have noticed that! At least I am finally getting ananswer. Now I actually get an answer in the sevavg field, but no matter how many sev's are entered it divides by 15 ( the max number of sev's).
Thanks for the tip. I can see your point (function names).
I renamed the function 'severityAverage()". Here's what happens: On the form the 15 "sev" values are actually entered into the forms by another Javascript. There are three form fields per Sev field. A calculation is run that adds two of...
I removed the brace and tried it, then the closing brace (I think I truncated one closer above) still no-go. The code looks like it should work.:
function sevavg(){
numVals = 0;
ttlVal = 0;
for (x=1; x<=15; x++){
if (x=1){
if (!isNaN(parseInt(document.Form.Sev.value))){...
I tried the code that mwolf00 sent. I modified it a bit to fix some minor syntax problems. When I call the fucntion the browser freezes like an endless loop has been created. Can you see any errors here?
function sevavg(){
numVals = 0;
ttlVal = 0;
for (x=1; x<=15; x++){
if...
Hi. I am trying to write a function that will take 15 form fields, sum the values and divide by all the non-zero values. For example: if 12 values aare entered I want the sum to be divided by 12 for the average.
Here's my cluncky code:
function sevavg() {
Sev = eval...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.