When Users create an Ticket and refresh the Page imediantly after that the Ticket will be created again
The same happens when replying to a ticket
I'm using the following Setup

Usually the users gets the "Are you sure you want to send the data again" warning, but I agree this is a problem
Yes it is. Btw. A lot pages in /scp seems to keep their anchor, e.g. #reply at the end of the URL and sometimes you don't really read the message from the browser and automatically hit "OK". Also when you close the browser window and it saves your tabs, the next time you open it (and don't remember what you did last time) you're annoyed by the browser message.
Yes, the Post/Redirect/Get is the answer; however, the current osTicket framework lacks support for caching the success banner for display on the next request. That's something we intend to address in the framework rewrite
In the 1.9.12 version this isn't been fixed.
Can someone suggest a code for avoid this problem?
Hi,
i add java script for refresh page to go same page without post data after posted replay.
in include > client > view.inc.php added this line :
<script type="text/javascript">setTimeout(function(){ window.location.href = "tickets.php?id=<?php echo $ticket->getId(); ?>#reply";}, 1200);</script>
after:
<div id="msg_notice"><?php echo $msg; ?></div>
and summary :
<div id="msg_notice"><?php echo $msg; ?></div>
<script type="text/javascript">setTimeout(function(){ window.location.href = "tickets.php?id=<?php echo $ticket->getId(); ?>#reply";}, 1200);</script>
Hi, MohsenBahraminejad
Where exactly in view.inc.php I should put this two lines ?
Does someone has a fix for this please, respond.
Hi, MohsenBahraminejad
Where exactly in view.inc.php I should put this two lines ?
find <div id="msg_notice"><?php echo $msg; ?></div> and write script after it.
This will be addressed when #4509 is accepted/merged.
Cheers.
Hi, MohsenBahraminejad
Where exactly in view.inc.php I should put this two lines ?find
<div id="msg_notice"><?php echo $msg; ?></div>and write script after it.
$urls = array();
foreach (AttachmentFile::objects()->filter(array(
'attachments__thread_entry__thread__id' => $ticket->getThreadId(),
'attachments__inline' => true,
)) as $file) {
$urls[strtolower($file->getKey())] = array(
'download_url' => $file->getDownloadUrl(),
'filename' => $file->name,
);
} ?>
showImagesInline();
This is how i did it but it stil doesn't work, it creates a ticket after i refresh the page. is there a script that when i click refresh it brings me to the orginal page?
It works i followed these steps #4509
Addressed with:
Most helpful comment
Hi,
i add java script for refresh page to go same page without post data after posted replay.
in include > client > view.inc.php added this line :
after:
<div id="msg_notice"><?php echo $msg; ?></div>and summary :