PHP Wizards

From: Ken (SHIELDSIT)26 Apr 2011 15:09
To: Peter (BOUGHTONP) 99 of 101

Pete do you know of a way to do this:

 

Say one of my users generates a report. I then ask them to add it to the monthly report. If they forget or something I want it to warn them if they click the back button or close the browser. Is there some Java or CF code that will do that?

From: Peter (BOUGHTONP)26 Apr 2011 16:13
To: Ken (SHIELDSIT) 100 of 101
YesNoMaybe. :P

What do you mean by "if they forget or something" - should the generated report always be added to the monthly report?

If so, just do it without asking them.

If not, under what conditions should it be added?

If those conditions can be determined in advance, make it a selection they do before even running the report.

(i.e. in general, give options to the user up-front, rather than bugging them with alerts after the fact.)

Anyway, for the functionality, it's main JavaScript you want (which is entirely different to Java, despite the similar names), though probably want a bit of CF too.

For closing the browser, the best you've got is the onunload JS event for the body, which will fire on more than just closing, but you can't avoid that.

For detecting back button, you'll want to set some flag on each request (e.g. a cookie), and then use JavaScript to call a webservice to check if that value is the latest one or an old one.

Not sure if that's explained very well, but don't have time for better right now... try googling it and someone might have an existing chunk of code you can use.
From: Ken (SHIELDSIT)26 Apr 2011 16:16
To: Peter (BOUGHTONP) 101 of 101
Good point. I think I will have it do it without asking if it isn't already in the database.