1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Two records with apply button

Discussion in 'Community' started by Intelartifice, Sep 4, 2019.

  1. Intelartifice

    Intelartifice Member

    Level: Community
    Hello,
    I embedded a form in an article but when I click on apply button and after I click on save button two records are created. Yet the form is still in edition. The form has pagination groups.
    I have set the joined data on "merge and reduce data" in the list setting 'cause i'm using repeat groups in the form. The form has pagination groups.
    But nothing helps

    This problem is not encountered on the form itself, only when embedded in article.

    Someone has an idea?
    Thanks
     
  2. Intelartifice

    Intelartifice Member

    Level: Community
    Friendly bump :)
     
  3. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    This issue got confirmed by @troester, I'm working on it at the moment.

    -- hugh
     
  4. Intelartifice

    Intelartifice Member

    Level: Community
    Thanks cheesegrit ;)
     
  5. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    OK, I think I misunderstood what you guys were saying. I thought you meant two records were created when you hit Apply. But what you are saying is that if you hit Apply, then hit Save, the Save creates a new record.

    I think that's more of a "feature" than a "bug", and that "Apply" isn't really a valid function when using a content plugin with view=form and no rowid. That combination is basically "create a new record", not "edit a record".

    When the AJAX form submission returns in a plugin, it isn't returning any form data. It just returns a success or fail status (and any errors in the latter case) ... and whether the form should be cleared. What is happening in this case is that the code is such that if the Apply button is used, we don't clear the form. Which works fine if the form was loaded with a rowid ("edit a record"), because the rowid is known. But as you discovered, if you've loaded the plugin with no record, then after the Apply, the form still doesn't know the rowid ... it's still in "create a new row" mode, so applying or saving again is going to create a new record.

    So the real "bug" in this case is that even after an Apply, the form should be cleared if it's a content plugin and was loaded with no rowid.

    It wouldn't be impossible to change this behavior, but it wouldn't be trivial.

    -- hugh
     
  6. troester

    troester Well-Known Member Staff Member

    Level: Community
    No. Ignore the Apply behaviour for the moment.
    On my test site a form in a content plugin is creating 2 identical records (different record ids) with one click on submit.
    It's with any form, also with a new one, just one field element and submit button (no apply button at all).

    But as I said in our discussion: it's only replicatable on one of my test sites, on all others (same server, same Fabrik) it's submitting correctly. And it doesn't matter if this "wrong" site is running Fabrik GitHub version or reset to 3.9 tag.

    @Intelartifice :
    Which other Joomla extensions, plugins, templates are you running on your site?
     
  7. Intelartifice

    Intelartifice Member

    Level: Community
    Hi troester,
    Joomla 3.9.11 fabirk last update August 2019
    I'm using vik-appointment component up to date
    sourcerer plugin up to date
    osdcontent plugin. up to date
    Template : protostar
    But on the page where the issue appear I use sourcerer and a Webrtc JS script which works well. Even without the JS script the issue appear.
    Anyway I've changed the my way, I display a list in content with Ajax add and edit form and for the moment it works well.
    But i'm still digging to find a way to do it with a form.
    J-M
     
  8. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    @Intelartifice do you have the same issue that @troester is describing, that just a single click on a submit button (Save or Apply), or is your issue the one I described, where hitting Save after hitting Apply will create a second record?

    -- hugh
     
  9. Intelartifice

    Intelartifice Member

    Level: Community
    Hi @cheesegrits
    Yes, my issue is the one you described.
     
  10. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    OK, in that case, @troester 's issue doesn't apply to you.

    And the "solution" is simply that you can't use "Apply" when loading the form with a content plugin with no rowid, ie. when the plugin is operating in "create a new form" mode. You can only use "Save", and that's going to clear the form after you save, so you are back to a blank form.

    -- hugh
     
  11. Intelartifice

    Intelartifice Member

    Level: Community
    hello,
    yes that's it, I realized it.
     

Share This Page