DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   JavaScript / DHTML / AJAX (http://www.daniweb.com/forums/forum117.html)
-   -   prevent user from going back or disable submit (http://www.daniweb.com/forums/thread200702.html)

itnagusak Jun 30th, 2009 10:06 am
prevent user from going back or disable submit
 
i have a form being filled. i don't want the user to be able to submit twice. how can i either prevent the user from going back or disable the submit button?

i am currently disabling the submit button but when the user clicks back(from the next page) it asks whether it should resend data. when the data is resent it loads the original version of the page(without submit disabled).

can someone help me with this? thanks.

aashishn86 Jun 30th, 2009 10:57 am
Re: prevent user from going back or disable submit
 
are you using asp or any other server side scripting language ?

itnagusak Jun 30th, 2009 10:59 am
Re: prevent user from going back or disable submit
 
i'm using javascript

aashishn86 Jun 30th, 2009 11:01 am
Re: prevent user from going back or disable submit
 
Quote:

Originally Posted by itnagusak (Post 904110)
i'm using javascript

javascript is for client side

anything for server side ?

itnagusak Jun 30th, 2009 11:12 am
Re: prevent user from going back or disable submit
 
no

aashishn86 Jul 1st, 2009 3:26 pm
Re: prevent user from going back or disable submit
 
can't think of anything
i'll post back if i can figure a way out...

aashishn86 Jul 1st, 2009 3:27 pm
Re: prevent user from going back or disable submit
 
but if you aren't using any client side scripting language , how are you saving the data ?

itnagusak Jul 2nd, 2009 1:34 am
Re: prevent user from going back or disable submit
 
saving it to a file using php..is that a scripting language?

aashishn86 Jul 2nd, 2009 2:54 am
Re: prevent user from going back or disable submit
 
Quote:

Originally Posted by itnagusak (Post 905984)
saving it to a file using php..is that a scripting language?

yeah..... :)

itnagusak Jul 2nd, 2009 3:02 am
Re: prevent user from going back or disable submit
 
i tried using sessions..
i set a sessions variable to 1 if the form data was submitted.
i check if the the variable is one on the concerned page and if it is i call a function which disables the submit button. but this doesnt work either. any thoughts about this?

heres the code
<?php
if($_SESSION['disable']==1){
echo "<script type="text/javascript"> disablesbmt(); </script>";
}
?>


All times are GMT -4. The time now is 4:08 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC