munna
munna

Reputation: 187

Deleting form values from cache using jQuery

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

Upvotes: 0

Views: 137

Answers (1)

Josh Pearce
Josh Pearce

Reputation: 3455

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

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

Upvotes: 1

Related Questions