Jump to content

[SOLVED] click twice


asmith

Recommended Posts

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 ?

Link to comment
https://forums.phpfreaks.com/topic/84990-solved-click-twice/
Share on other sites

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...

Link to comment
https://forums.phpfreaks.com/topic/84990-solved-click-twice/#findComment-433404
Share on other sites

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 ?

Link to comment
https://forums.phpfreaks.com/topic/84990-solved-click-twice/#findComment-433500
Share on other sites

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 ?

 

Link to comment
https://forums.phpfreaks.com/topic/84990-solved-click-twice/#findComment-433513
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.