hello

is there a way to stop a page refreshing in a browser? (wish i'd separated my sql from my displayed results and used a redirect, but i didn't and am just wondering if there is a quick way around preventing refreshing of a page, so as the sql doesn't run again)?

thanks

Recommended Answers

All 3 Replies

Hi,

If you stopped the page from refreshing how would it get the results in the first place? i don't really understand your question?

You would be better off creating methods in cfc's for your sql statements, separate your logic from your display output, always a good practice.

jedimatt

thanks for your reply. yes with hindsight i should have separated the sql, but unfortunately i didn't think far enough ahead - i am quite new to this kind of thing, but you live and learn as they say...

(the results display when you first link to the page which contains the sql to insert data and then to display it - which was ok, until i refreshed the page and realised that this meant the sql would reinsert the data)

anyway, i am thinking now of testing somehow to see if the insert has been made, maybe using sql or making use of setting session variables - otherwise i'll have to go back and split the sql from the results i guess - 'guess' being the operative word - as i say i am quite new to all this!!

thanks again for your reply - it has at least confirmed what i new that my initial setup is not good! :)

Yeah, you don't want to prevent a page refresh. That takes quite a bit of JavaScript and quite frankly would annoy users. They don't want you to change their browsers behavior. Fix your code logic. Don't mess with browser hacks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.