1. Fabrik 3.8.1 has been released. It is mostly bug fixes and feature enhancements, but does include two new plugins (push notifications, and the sequence element). As usual we strongly recommend testing the new release on a sandbox if your application is mission critical, and always do an Akeeba backup before updating.
    Dismiss Notice

submit once

Discussion in 'Professional Support' started by bea, Sep 14, 2018 at 11:48 AM.

  1. bea

    bea Active Member

    Level: Professional
    Hi,
    I noticed another issue and don't know how solve:

    I've a form with several script running on final submit. When a user now has 2 tabs open with the same form, he can submit both. One of the script generates the next record and the results are 2 new next records.

    In F2 there was the plugin submitonce to prevent double submit.

    Cheers,
    Bianka
     
  2. troester

    troester Administrator Staff Member

    Level: Community
    I assume this was also some custom code?
    Can't you use the lockrow plugins to prevent the user to open the record twice?
     
  3. bea

    bea Active Member

    Level: Professional
    Hi troester,
    I've checked my old F2 files. submitonce was part of the form.js plugin:
    Code (Text):
    //class name needs to be the same as the file name
    var submitonce = new Class({

        initialize: function(form)
        {
            this.form = form; //the form js object
        },
     
        //called when a repeat group is duplicated
        onSubmit: function(event){
            $('fabrikSubmit'+this.form.id).disabled = true;
            $('fabrikSubmit'+this.form.id).value = 'Speicherung läuft....';
        }
    });
    I needed this in the past, to prevent running script twice on double click.

    Also I've found this on J2.5 Fabrik forums: http://fabrikar.com/forums/index.php?threads/submit-once-a-form.22360/

    The lockrow doesn't work for the same user, if he opens 2 tabs with same form.

    Cheers,
    Bianka
     
  4. troester

    troester Administrator Staff Member

    Level: Community
    I think in Fabrik3 you have a form option in Form processing "Show loader" which prevents double submission on double click.

    But I don't know if this will do if the user has two browser tabs open with the same form (why is he doing this).
     
  5. bea

    bea Active Member

    Level: Professional
    no, it doesn't work with "show loader".
     
  6. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    I could probably tweak lockrow so the second form wouldn't submit, after the first submit unlocks it.

    -- hugh
     
  7. bea

    bea Active Member

    Level: Professional
    That sounds great! Take your time, I'm not in a hurry.
     

Share This Page