Multiple submit problem in CActiveForm


My problem is as follows: my form writes multiple entries in the database even after I have disabled the submit button on click. I have also tried hiding the button’s div on click. I find it very strange that even if I disable the button on click, the data is doubled in the database. I think I have looked everywhere, and still haven’t found a solution. This isn’t a problem of multiple clicking. Based on how many drop-down lists I select in my form before pressing submit, or on how many text fields I fill in, I have noticed that more duplicate entries are written in the database. I can get up to 7+ duplicate entries in the database.

Any idea why this is happening, and how I can solve it?

If the last field in my form is a text field, which is required/mandatory ( as set in the model ), and I write in that field , the problem disappears in Chrome, but I get double entries in Firefox…

I hope this link works so you can see my _form view:

The problem seems to solve itself if I disable Ajax validation… Do I need that kind of validation?

If you need a client-side validation and use some autocomplete etc. things then you should use Ajax validation

Well, I only have client validation enabled now, and it seems to work without Ajax validation. I don’t have any auto-complete fields. I don’t understand why having Ajax validation enabled causes such problems.

Could it be possible, the your validation-code and your save-code is bundled together, so that the first DB insert happed at validation time?

Did you use firebug (or something like this) to debug how many request are fired from client? To see what is validation and what is an submitted form (in order to insert this into the DB).