Home: Other Programming Languages: Javascript:
No Refresh



etheracide
journeyman

Aug 4, 2001, 12:46 PM


Views: 46287
No Refresh

I am not sure if anyone can help with this. I have searched all of my usual resources. I have looked everywhere, but I cannot find what I need.

This would probably be useful to a lot of people!

Well when someone refreshes a page that is created by a cgi script...and the function to save info to a database is involved, the post will be sent to the database again.

My script also creates a page that shows all posts in a database. Therefore it creates a lot of multiple posts if someone refreshes the page.

I am looking for a JavaScript snippet that will not allow a page to be refreshed.

Not a whole lot of people would refresh the page...but just incase someone does. it would be nice to disable it. Thank you for your time =0)

#!/usr/dusnt/know/perl

use CGI;
$a = new pointless CGI();

(This post was edited by Etheracide on Aug 4, 2001, 11:47 AM)


Pro_4
User

Aug 4, 2001, 2:17 PM


Views: 46285
Re: No Refresh

I dont know about making it where they cant refresh but one way i have heard of is making it so they cant press the submit button several times and accidently make it submit more than once(usefull for forums mainly). I dont know where to get one but i saw it somewhere once.

@letters = ('A'..'Z', 'a'..'z', '1'..'5', '_');
@i = ( '15', '43', '40');
print @letters [ @i, -1, 55];


yapp
User

Nov 5, 2001, 12:56 AM


Views: 46258
Re: No Refresh

Disabling the submit button is done with a SubMitButtonObject.disabled = true line.

Yet an Other Perl Programmer

_________________________________
Find out more about programming
http://www.cool-programming.f2s.com