Welcome Guest, Not a member yet? Register   Sign In
Resend Post data...problem
#1

[eluser]tnathos[/eluser]
Hi, i have the next problem,

I make a page what handler Tabs Jquery, thats work fine, in one tab call a view, this view contain a form for insert data in the DB.

All work's fine, insert data etc, but the problem is when i press F5 after the insert one register, whit the form in the view clean, the app insert twice again..

So i can destroy the information in the array post? or handler this problem?
#2

[eluser]garymardell[/eluser]
Why not just add a check to see if the information has already been entered. See if the data exists.
#3

[eluser]davidbehler[/eluser]
After the data is submitted you can do a redirect...that should stop people from re-submitting the form by pressing f5
#4

[eluser]tnathos[/eluser]
I redirect, but the problem is tha app handle all views in tabs.. so, when submit the data, redirect to principal view what contains the tabs.. the problem here, is F5... resend all data..
#5

[eluser]_www_[/eluser]
Hello tnathos,

i'm sorry but i have the feeling your problem description is not complete.

You have an application and use jquery tabs to display the views of data.
Ok. But it seems that you call controller functions for loading these tabs/views, that insert data into the database. I cannot imagine another way why data should be submittet on a new seperate load of the page after a redirect. Redirect = clean new load, like you just typed the url into your browser and pressed enter.

Do you have a screenshot at hand? Or some code?

Greetings
#6

[eluser]Zeeshan Rasool[/eluser]
Quote:I redirect, but the problem is tha app handle all views in tabs.. so, when submit the data, redirect to principal view what contains the tabs.. the problem here, is F5… resend all data..

I think redirect is useful for this, but i couldn't understand why its being redirected again. please check your code again and confirm OR provide some extra detail..

Cheers
#7

[eluser]tnathos[/eluser]
Hi all, i find the solution, send the data between ajax and no post directly, this form is to easy beacause if the user press f5 the data store in the browser not resend when the user press f5..

For all undestarnd, the problem it whas, i have a view what contain a tab controller whit JQUERY, in this controller call other views, but the main page is same, so when i send data whit a view into tab, the broser store the array _post and if the user press f5 re-send all data to DB. this easy solution if the data send using ajax and no metod post.

check the code ajax, what send data to model for insert to database, the important here is not create tag <form> this is not necessary.

In the submit=<input type="submit" name="button" id="btncc">


[removed]
function newcc()
{
$.ajax({
type: "POST",
url: "/xxx/xxxx/xxxx/",
cache: false,
data: "valor="+$("#valor").val()+"&tipo;="+$("#tipo").val()+"&email;="+$("#email").val()+"&datepicker1;="+$("#datepicker1").val()+"&city;="+$("#city").val()+"&country;="+$("#country").val()+"&platform;="+$("#platform").val()+"&numope;="+$("#numope").val()+"&nameBank;="+$("#nameBank").val()+"&account;="+$("#account").val(),
success: function(msg){
$('#comment').html(msg);
$("#valor").val('')
}
});
}




Theme © iAndrew 2016 - Forum software by © MyBB