I created few inputs on the fly with jQuery. but if an error cought on php side then you have to go back to correct errors they all disappears. I can see the problem and why it is caused. but how can I fix this issue? is there a trick to keep them when i click go back?
here is how I add those input fields
//append fields
for(var i = inUseTotalCheck+1; i <= totalToUse; ++i){
$('#checkListPanel').append(
'<div class="label-input" id="check_' + i + '">' +
There may be several strategies to use here but the best one I can think of is to do your validation on the client-side. That way you can catch any possible invalid data before the form is submitted to the server and you do not have to go back.
I thought of a solution but still did not work! What I did is precreated the input fields but hid all of them exept one and as the user request more then more show by doing show/hide
However, when I go back they all disappear!
Is there a way in jQuery to hide/show when a user click go back?