MasterACE14 Posted November 2, 2007 Share Posted November 2, 2007 Morning Everyone, I have a function which is suppose to disable a form once the submit button has been clicked once. But it isn't working. here is the script, and an example form: <script language="JavaScript"> function Disab (val,formname) { if(val=="1") {formname.Submit.disabled=true} if(val=="2") {formname.Button.disabled=true} } </script> <form name="strikeops" method="post" action="index.php?page=ability_result"> <input type="hidden" name="strikeopsprice" value="<?=$player_strikeops_price?>"> <input type="hidden" name="strikeopsamount" value="<?=$player_strikeops_amount?>"> <input type="submit" name="buy" value="Train" onClick="Disab (1,strikeops)"> </form> Regards ACE Link to comment https://forums.phpfreaks.com/topic/75853-disabling-form-once-button-has-been-clicked-once/ Share on other sites More sharing options...
lighton Posted November 3, 2007 Share Posted November 3, 2007 I didnt even know you could do that anyhoo here are some obvious suggestions to why it might not be working You havent fetched the form object in the script add an id="strikeops" to the form then in the javascript function add var formObj = document.getElementById("strikeops"); and also it should be formObj.submit and not formObj.Submit as javascript is case sensitive hope this helps Link to comment https://forums.phpfreaks.com/topic/75853-disabling-form-once-button-has-been-clicked-once/#findComment-383949 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.