Hi all. Am messing about with an ajax form at present which loops through records in a DB. This is my issue:
I have a reset image link in my form (called "file_edit") which calls a 'confirm reset':
function reset() {
if (confirm("Reset? You'll lose any changes!")) {
document.file_edit.reset();
}
}
This works well. When I press prev/next buttons, my fields are updated programmatically via Ajax. I get values from DB and pass them back to js via json which then enters the data into the form fields. So in other words, only the values are replaced - not the actual form itself.
If I make changes to say the fifth record but then decide to reset the form, I am greeted by a return to the first record - not what I wanted.
Has anybody come across this problem, and if so, how do I ensure that I 'stay on the same record' on reset?
Not urgent. Thanks.
//EDIT
I suppose what I'm looking for is a sort of 'restore point' for the reset link. Perhaps I would be better off just reloading the current record? I know the reset form is controversial.