5

Has anybody encountered this kind of issue where in my edit form, after clicking submit, it creates a new record instead of saving the changes I made? it was able to load the data of the item i clicked. I have a workaround with this issue but it's very tedious. I re-install the original component where it works and then I had to re-copy the codes I modified. After copying the codes I modified, the form works without re-creating the item i clicked for editing? I'm getting annoyed by this.

1
  • Does the ID field have to be called ID? I am experiencing the same issue with my unique field called dancer_id - I can create new records, but cannot edit one as it automatically creates a new record.
    – Mhaddy
    Jan 10, 2016 at 5:00

1 Answer 1

5

Make sure that your form has an ID field. Without the ID field, Joomla! will create a new record, even when editing. It is okay if the ID field is hidden.

3
  • Thanks a bunch! I was trying to hide the ID in my Edit Form by removing it completely from the display, I forgot that i can include it by using hidden. Dec 10, 2014 at 6:04
  • Zachary, Did you set any rules to make the ID blank? How did you do it? Did the EditForm created a new record? I believe the initial changes you made to the record ID is what I'm looking for, I need to make the EditForm to create a new record each it save it to a list. I've tried to replicate your initial changes, but I get an error that the form CANNOT save with ID record equals to null or 0.
    – user4061
    Apr 13, 2015 at 16:35
  • @Jose: In the XML file that defines the form, you should have an 'id' field declared. That is where you set the default value to 0. When the field is drawn on the form, it will contain the ID of the current record when editing, or a 0 when creating a new record. I wonder if your problem is in your model and not your form? Apr 14, 2015 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.