Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hi @rymanacevedo,

    I’ve not identified exactly the reason why your function is called twice when the form include multiple pages, because your current form has only one page and the issue is not occurring, however I’ve some recommendations.

    First, You have included in the custom code two events “document ready”:

    jQuery(document).ready....

    and

    jQuery(function(){....

    I recommend in this case to use an event triggered by the plugin,

    fbuilderjQuery(document).one('showHideDepEvent', function(){
    var $=fbuilderjQuery;
    /**** Insert the rest of your code here, using the $ symbol as a reference to jQuery ****/
    });

    That is, remove the couple of document ready events, and to include all your custom code as a replacement of the line of text:

    /**** The rest of code here using the $ symbol as a reference to jQuery ****/

    and using the $ symbol as a reference to the jQuery instance used by the plugin.

    Second, as the pluging reduces the code to only one line, please, don’t use the format of single line comments for commenting the code, use the format of multiple lines even if it is only one.

    // Please, don't use double slash

    /* use this format */

    If after modify your code the issue persists, please, clone your form, insert a page break in the cloned form, and send me the URL to the webpage where the new form was inserted for checking the issue in action.

    Best regards.

    Thread Starter rymanacevedo

    (@rymanacevedo)

    I changed the jQuery to a global $ like you requested. For some reason the double append still shows up.

    Here’s a link to the test page: Test Page

    I’ll try to figure out why it’s still in this process as well. Could it be something to do with a refresh?

    Thanks for your help,

    Ryan

    Plugin Author codepeople

    (@codepeople)

    Hi,

    I’ve not identified yet the reasons why your button is clicked twice, however, please try the following modification:

    Modify the line of code:

    $("#CDSbtn").on("click", function () {

    as follows:

    $("#CDSbtn").on("click", function () {
    if(typeof my_counter_flag == 'undefined') my_counter_flag = 0;
    my_counter_flag++;
    if( my_counter_flag%2 == 0) return;
    
    /* The rest of code here */

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Functions calling twice’ is closed to new replies.