Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a way to invoke JavaScript function, by calling element outside of form via script
    text
    copied!<p>I am trying to call a simple function when a value is selected on the form. Problem is that I don't have access to the code where I can set the function directly on the field. </p> <p>If I were to have access I would simply write onChange event directly inside the element. Is there any way to call element inside the script and apply the onChange event there?</p> <p>Here is the my script currently. I am trying to take two values from separate fields and apply their sum to another field. </p> function changeQty () { var productName = MainForm.elements["ProductCode"].value; var Quantity1 = MainForm.elements["SELECT___"+productName+"___23"].value; var Quantity2 = MainForm.elements["SELECT___"+productName+"___24"].value; var QtyUpdated = Quantity1 + Quantity2; MainForm.elements["QTY."+productName].value = QtyUpdated; } <p>And here is the form element where I want the function to fire. I only have access to the header where script can be inserted, but not to elements on the page. Also form already has some other javascript. Can I have two onChange events?</p> <p> -12.00</p> <p>-11.50 -11.00 -10.50 -10.00 -9.50 -9.00 -8.50 -8.00 -7.50</p> <p>-7.00 -6.50 -6.00 -5.75 -5.50 -5.25 -5.00 -4.75 -4.50</p> <p>-4.25 -4.00 -3.75 -3.50 -3.25 -3.00 -2.75 -2.50 -2.25</p> <p>-2.00 -1.75 -1.50 -1.25 -1.00 -0.75 -0.50 +0.50 +0.75</p> <p>+1.00 +1.25 +1.50 +1.75 +2.00 +2.25 +2.50 +2.75 +3.00</p> <p>+3.25 +3.50 +3.75 +4.00 +4.25 +4.50 +4.75 +5.00 +5.25</p> <p>+5.50 +5.75 +6.00 &nbsp;&nbsp;</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload