can i call onload while submitting the form

function setFrieghtQty(tmpId)
            totalWeight =document.getElementById("totalWeight").value;

      var freightAmount            = document.getElementById("billedAmount1").value;
      var totalAmountObj            = document.getElementById("billedAmount"+tmpId);
      var freightQtyObj            = document.getElementById("freightQty"+tmpId);
      var conversionObj            = document.getElementById("conversionFactor"+tmpId).value;

      var currentFreightQty      = freightQtyObj.value;

            else if(tmpRateBasis.value =="KG")
                  currentFreightQty      = totalWeight;      
                  totalAmountObj.value      = tmpRatePerUnit*conversionObj*currentFreightQty;

      in our jsp when i click refresh in the body onLoad i will call one javascript function and inturn will call setFrieghtQty(tmpId)

      when i click refresh ,values cumulating here and final result is displaying correctly

      but when i submit i want to call body onload function before submitting the form
LVL 20
chaitu chaituAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

In your submit you need to call the function again explicitly by giving the name
. i presume that yiu are submitting a form?
<form name ="frm" method =post onsubmit = "callfunc()">
<input type = "Submit">
can't you put:


into your form tag?
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

chaitu chaituAuthor Commented:

when i click Enter button ;

in the form i will call

<form name="frm" onSubmit=validateForm()>

my enter button like this
<input type="submit" name="Submit" id="Submit"  value="ENTER" class='input'   onClick="setAction('ENT')">

in the validateForm() function i want value of Submit button i.e ENTER;

how can i achive this
//something like this, i presume you just want the value of the button ?
//what does setaction('ent') do ?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

function validateForm()
 var submitValue = document.frm.Submit.value;
         alert( submitValue )

return true

<form name="frm" onSubmit="return validateForm()">
<input type= "submit" name="Submit" id="Submit"  value="ENTER" >


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial

  <input type="submit" name="Submit" id="SubmitButton"  value="ENTER" class='input'   onClick="setAction('ENT')">


 var submitValue = document.getElementById( 'SubmitButton' ).value ;
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.