Browser message disrupting user experience

Asked

Viewed 58 times

0

I have a PHP page with product search form. As soon as the user does the search I update the products of the page where the user enters the product detailing on another page. The page is responsive, so the user uses the application on the mobile. And a basic function for those who want to open the previous page is to click the "back" button of the device itself. Or even in the desktop browser. The problem when the user uses the back. It always falls on the form resubmission page, where the layman thinks it is an error.

inserir a descrição da imagem aqui

Do you have any technique for not falling for this message?

My form filter looks like this:

if(isset($_POST['referencia'])&&$_POST['referencia']!=""){
    $_SESSION['referencia_c']=$_POST['referencia'];
}
if(isset($_SESSION['referencia_c'])){
    $filtro .= " AND LOWER(p.descricao) LIKE LOWER('%".$_SESSION['referencia_c']."%') ";
}
  • One technique I would use to avoid this disorder was to use Ajax. Have you thought about doing this?

  • But even if I do it in ajax, after I enter another page and return to the search page, this error does not happen?

  • If you do it the right way, using Ajax, it doesn’t happen.

  • As usually this error happens when submitting a form, edit your question and put your html form.

  • I will edit and put the form, but when I return the page I am not sending any form. It turns out that when I go back to the page by entering the product search page that has the form.

1 answer

0

You could avoid this problem, using Ajax, to detail it and put a back button to return to the listing. But that would probably change your structure too much. But it would have a more efficient way, which is to change the "last page accessed" by javascript, to detail page without form data, not generating the message. You would do this by entering the detail page:

//Pra desativar o evento de voltar
window.onpopstate = function() {return false}; history.pushState({}, '');

//pra redirecionar pra tela de pesquisa sem os dados, não exibindo a mensagem
location = 'http://teladepesquisa.com/'
  • On the screen I have a back button, but users are used to using the mobile button.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.