FinalFrontier Posted January 20, 2012 Share Posted January 20, 2012 Is it possible for JavaSscript to toggle a submit button (toggle meaning as though I clicked it)? I will be using it in this code: <SCRIPT type="text/javascript"> if (document.forms["form"]["quantitys"].value > '.$row['quantity'].') { alert ("The quantity you wanted for product '.$row['id'].' is no longer available and will be changed to the highest available quantity."); document.forms["form"]["quantity"].value = '.$row['quantity'].'; // JAVASCRIPT TOGGLE SUBMIT } </SCRIPT> The submit button: <INPUT name="submit" type="submit" value="UPDATE QUANTITY"> Link to comment https://forums.phpfreaks.com/topic/255405-can-javascript-toggle-a-submit-button/ Share on other sites More sharing options...
Adam Posted January 20, 2012 Share Posted January 20, 2012 You don't want to click the submit button, but submit the form. Simply call the submit() method on the form object: document.forms["form"].submit(); Link to comment https://forums.phpfreaks.com/topic/255405-can-javascript-toggle-a-submit-button/#findComment-1309504 Share on other sites More sharing options...
FinalFrontier Posted January 21, 2012 Author Share Posted January 21, 2012 Ah yeah..! That makes more sense. Thank you, Adam. Link to comment https://forums.phpfreaks.com/topic/255405-can-javascript-toggle-a-submit-button/#findComment-1309719 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.