views:

41

answers:

1

I am facing this bizarre problem in my asp.net mvc application: In one page I am showing a table full of data of a model class. Each row of data has a Edit image <img src='somesrc' onclick='fnClick({mode:'edit',..other params});/>'.

In addition to that I've Add button also to populate the same model class mentioned <a href='#' onclick=fnClick({mode:'add'});>Add</a>.

I am using a form which I use both for Edit and Add operation, and I call same function written in jQuery for these two operations. This function is passed with a mode param depending on which button is clicked. This mode is used to either populate the values on edit or opening blank form for add. Now on the page if I click Edit first and then add, the add operation still shows the data of the Edit form. Is this a cache issue or something I'm missing

+1  A: 

When you click the add button, find the form element, and reset it:

#('#myformid')[0].reset()
Josh Pearce