Yesideez Posted April 19, 2009 Share Posted April 19, 2009 heh doesn't that sound like a front-page story title for a newspaper I have a submit button on my form: <input type="submit" name="subsave" value="Save Changes" onclick="this.value='Please Wait';this.disabled=true;" class="gadbut"> I'm detecting it with this: if (isset($_POST['subsave'])) { If I have the disable the button bit my page refreshes but the submit button is completely ignored. If I make it so it only changes the text and doesn't disable it detects the submit button. I've disabled a submit button before with an onclick event but can't remember how. Javascript isn't my strongest point... Quote Link to comment Share on other sites More sharing options...
Kieran Menor Posted April 19, 2009 Share Posted April 19, 2009 Wouldn't it theoretically be a desired effect that disabled form fields aren't included when the form is submitted? Why not just use some other form field to determine if a form was submitted or not? Quote Link to comment Share on other sites More sharing options...
Yesideez Posted April 19, 2009 Author Share Posted April 19, 2009 It prevents a user from spamming the site if a connection is slow by repeatedly clicking submit. I had this happen on another site I was helping with a while back and it was very frustrating so we disabled the submit with Javascript once it had been clicked - fixed the problem instantly. Quote Link to comment Share on other sites More sharing options...
Kieran Menor Posted April 20, 2009 Share Posted April 20, 2009 Yes, I know, but just use some other field in your PHP code to determine if the form was submitted. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted April 21, 2009 Author Share Posted April 21, 2009 Why? I've had this working in the past but I'm using JS differently than I did in the earlier site and it worked. Trying to figure it out again! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.