0

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.

Edited by diafol: n/a

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by liamfriel
0

I finally gave up on this as it caused more problem than it was worth - unless somebody can point me at a nice solution?

Have simply done a 'reload current record from DB'. Doh! Perhaps I was over-engineering the solution.

0

When someone clicks reset you could ajax the deletion of the current db record, or create a new one?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.