javascript - send <form> information through 2 different Submit buttons, that calls the same function but need to know from which submit button came the call -


i'm sending information through 2 different submit buttons, calls same function need know submit button came call.

i have form 'x' parameters i'm going send js function thats going validate data. after validate data need send data diferent js function depending on submit button press

my form this:

<form name="datos_configuracionrangos_tension_laboral" action="#" onsubmit="consultar_configuracionrangos('tension', 'laboral'); return false" method="post">     <button id="button" type="submit" name="graficar" value ="graficar">graficar</button>        <button id="button2" type="submit" name="guardar" value ="guardar"> guardar configuraciones</button>     </form>` 

one way allow script submit form, , use regular buttons.

<button id="button" onclick="validateme(this)" value ="graficar">graficar</button>  

...then in function:

function validateme(e) {      alert(e.value) <-- tells button presssed.      .... validation code ...      document.forms.datos_configuracionrangos_tension_laboral.submit(); } 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -