asmith Posted January 8, 2008 Share Posted January 8, 2008 i havn't upload my scripts yet. when a page load on localhost , everything almost run immediately. i've tried to click a form submit button 2 times soo fast , but i couln't . but when in online mode, when i click on buttons , they have delay , so i have time to click again and again . the problem i'm thinking i might have when uploading is : some of my scripts do something different when a user run them twice . for example if a user has posted a comment , then he do it again , a warning will be added to his "warning levels" . now if the user click to submit his first comment, (for example cause of the network delay) , he sees nothing has happend, then he click again . won't the script gave him a warn this time ?? is there anything i can do , for example if a second click was set then roll back the previous changing or something . any solution ? (without JAVA please , like disabling the button after the click) or i'm all wrong about this ? Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted January 8, 2008 Share Posted January 8, 2008 well the best solution would be disabling the button through Javascript but thats not what you want... they could be many approaches to it... you could prevent the user from submitting duplicate data... by checking the database or applying a unique key constraint on multiple keys... and then checking for unique key violation... but this is just a thought tho... Quote Link to comment Share on other sites More sharing options...
asmith Posted January 8, 2008 Author Share Posted January 8, 2008 the only thing i don't like JAVA for others things than visual is ,it can be disabled. but i'll give it a try . how can i make it with java anyway ? i mean disable after the click? Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted January 8, 2008 Share Posted January 8, 2008 code would be object.disabled = true; Quote Link to comment Share on other sites More sharing options...
asmith Posted January 8, 2008 Author Share Posted January 8, 2008 hmm <input type="submit" name="submit" value="submit" object.disabled="true" /> doesn't happen to work , should place that in html script tag ? Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted January 8, 2008 Share Posted January 8, 2008 should be <input type="submit" name="submit" value="submit" onclick="this.disabled = true" /> however you should do in in your form validation code... Quote Link to comment Share on other sites More sharing options...
asmith Posted January 8, 2008 Author Share Posted January 8, 2008 i testing it on this : <html> <body> <form action="none.php" method="post"> <input type="submit" name="submit" value="submit" onclick="this.disabled = true" /> </form> </body> </html> but it disables whole , do not send me to none.php . am i doing something wrong ? Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted January 8, 2008 Share Posted January 8, 2008 try this <html> <body> <form action="none.php" method="post" onSubmit="this.submit1.disabled = true;return true;"> <input type="submit" name="submit1" value="submit" /> </form> </body> </html> changed a few things Quote Link to comment Share on other sites More sharing options...
asmith Posted January 8, 2008 Author Share Posted January 8, 2008 thanks rajiv , you placed that java code on the form tag . now if i want to apply that for more than one button ? something like this : <form action="none.php" method="post" onSubmit="this.submit1.disabled = true;return true;" onSubmit="this.submit2.disabled = true;return true;"> don't think so , how to add more than one ? Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted January 8, 2008 Share Posted January 8, 2008 it should be in one onsubmit event <form action="none.php" method="post" onSubmit="this.submit1.disabled = true;this.submit2.disabled = true;return true;"> something like that... Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted January 8, 2008 Share Posted January 8, 2008 Well if you have a lot of buttons, it will be silly to do that. You can always create a JavaScript function that just loops through all the buttons and disables them. Quote Link to comment Share on other sites More sharing options...
asmith Posted January 8, 2008 Author Share Posted January 8, 2008 only 2 or 3. buttons. thanks a ton rajiv. 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.