Link to home
Start Free TrialLog in
Avatar of chaitu chaitu
chaitu chaituFlag for India

asked on

can i call onload while submitting the form

function setFrieghtQty(tmpId)
{
      
      if(document.getElementById("totalWeight")!=null)
            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;

      roundDecimals(freightQtyObj,3);
      var currentFreightQty      = freightQtyObj.value;

      if(totalAmountObj!=null)
      {
            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
Avatar of sajuks
sajuks

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">
</form>
can't you put:

    onSubmit="yourOnloadMethod()"

into your form tag?
hehehe
Avatar of chaitu chaitu

ASKER



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
ASKER CERTIFIED SOLUTION
Avatar of sajuks
sajuks

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or

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

then

 var submitValue = document.getElementById( 'SubmitButton' ).value ;