• Resolved nsaint

    (@nsaint)


    Hi,

    I’m receiving the error Uncaught TypeError: cf7sg[fid] is undefined on a dynamic dropdown menu I created, so the search function does not work, it just displays all results in the dropdown.

    I’ve deactivated all plugins apart from contact form 7 and this one and it still remains, along with using the default theme.

    Not sure what else to try.

    My code for the filter is

    add_filter( ‘cf7sg_dynamic_dropdown_custom_options’,’searchpart_dynamic_options’,10,3);

    function searchpart_dynamic_options($options, $name, $cf7_key){
    if(‘add-parts’!==$cf7_key || ‘searchpart’ !== $name){
    return $options;
    }

    global $wpdb;
    $data = $wpdb->get_results(“SELECT * FROM wp_ams_stock WHERE ams_part_price=’1′”);

    if (!empty($data)) {
    $options ='<option value=”0″>—</option>’.PHP_EOL;
    foreach($data as $partdata){

    $partinfo = $partdata->ams_part_num . ‘ ‘ . $partdata->ams_part_name;
    $partid = $partdata->ams_part_id;

    $options .= ‘<option value=”‘.$partid.'”>’.$partinfo.'</option>’.PHP_EOL;

    }
    }
    return $options;

    }

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    Uncaught TypeError: cf7sg[fid] is undefined

    can you give me the file name and line number on which the error occurs

    Plugin Author Aurovrata Venet

    (@aurovrata)

    so the search function does not work

    are you expecting a select2 dropdown? Have you enabled the select2 on the dynamic dropdown field in your form? This is not automatic, please view the video tutorial on dynamic lists to understand how to enable select2 fields.

    Thread Starter nsaint

    (@nsaint)

    Hi, yes the select2 is included in the shortcode, I have followed your tutorial the shortcode I’m using is

    [dynamic_select* searchpart class:select2 “source:filter”]

    Thread Starter nsaint

    (@nsaint)

    The error reported is

    <anonymous> ./dealertest/wp-content/plugins/cf7-grid-layout/public/js/cf7-grid-layout-public.js?ver=4.7.5:445
    jQuery 2
    each
    each
    <anonymous> ./dealertest/wp-content/plugins/cf7-grid-layout/public/js/cf7-grid-layout-public.js?ver=4.7.5:443
    jQuery 2
    e
    t

    Thread Starter nsaint

    (@nsaint)

    This warning also comes up

    jQuery.Deferred exception: cf7sg[fid] is undefined @./dealertest/wp-content/plugins/cf7-grid-layout/public/js/cf7-grid-layout-public.js?ver=4.7.5:445:11
    each@./dealertest/wp-includes/js/jquery/jquery.min.js?ver=3.5.1:2:2976
    each@./dealertest/wp-includes/js/jquery/jquery.min.js?ver=3.5.1:2:1454
    @./dealertest/wp-content/plugins/cf7-grid-layout/public/js/cf7-grid-layout-public.js?ver=4.7.5:443:29
    e@./dealertest/wp-includes/js/jquery/jquery.min.js?ver=3.5.1:2:30005
    l/</t<@./dealertest/wp-includes/js/jquery/jquery.min.js?ver=3.5.1:2:30307

    Plugin Author Aurovrata Venet

    (@aurovrata)

    [dynamic_select* searchpart class:select2 “source:filter”]

    that looks fine.

    Can you share your form html source here so I can test it on my server.

    Thread Starter nsaint

    (@nsaint)

    Thanks for your help, the code is

    <div class=”tktinput”>
    [backtotkturl back]
    </div>
    <div class=”clear”></div>
    <b>Enter Part Number/Name</b>
    [dynamic_select* searchpart class:select2 “source:filter”]

    [hidden van1 readonly “unknown”]

    <div style=”display:none”>[stockcol* stockcolumn readonly]</div>
    [hidden van2 readonly “unknown”]
    [hidden PartID readonly “unknown”]
    [hidden partidg readonly “unknown”]
    [hidden partnamenumber readonly “unknown”]
    [hidden processpart “n”]
    [hidden lastupdatedtkt default:shortcode_attr readonly]
    [hidden at default:shortcode_attr readonly id:adt]
    [hidden techn default:shortcode_attr readonly]
    [hidden tn default:shortcode_attr readonly]
    [hidden atn_text default:shortcode_attr readonly]
    [hidden progress default:shortcode_attr readonly]
    [hidden tnhide default:shortcode_attr readonly]
    [hidden sitename default:shortcode_attr readonly]
    [hidden sitenumber default:shortcode_attr readonly]
    [hidden cs default:shortcode_attr readonly]
    [hidden sb default:shortcode_attr readonly]
    [hidden loguser id:log readonly default:user_display_name]
    [hidden serpart “0”]
    [hidden techcol id:tcol “None” readonly]

    [hidden stockallocated readonly default:user_display_name]
    [hidden warranty id:w readonly]
    [hidden chargeable id:c readonly]
    [hidden installedin id:in readonly]
    [hidden totstock “0”]
    [hidden userlogin default:user_login]
    [hidden restockwhse “0”]
    [hidden consignpart readonly “unknown”]

    <div class=”clear”></div>
    <div class=”tktinput”>
    <b>ROBOT # *</b>
    [dynamic_select* robot-serial-num class:select2 “source:filter”]
    </div>

    <div class=”tktinput”>
    <b>QTY*</b>
    [select* quantity id:qtypt include_blank “1” “2” “3” “4” “5” “6” “7” “8” “9” “10” “11” “12” “13” “14” “15” “16” “17” “18” “19” “20” “21” “22” “23” “24” “25” “26” “27” “28” “29” “30”]
    </div>

    <div class=”tktinput”>
    <b>EQUIP TYPE*</b>
    [select* equiptype id:equip include_blank “BigMow Connected” “ParcMow Connected” “BallPicker Connected” “BallPicker Classic” “BigMow Classic” “Return System”]
    </div>
    <div class=”clear”></div>
    <div class=”tktinput”>
    <b>Reason for replacement*</b>
    [textarea* reasonpart 20×3]
    </div>
    <div class=”clear”></div>
    <div class=”tktinput”>
    <b>Photo of damage (optional)</b>
    [file part-photo-tkt limit:10mb]
    [hidden ifpartsused2 “Yes”]
    [hidden partused default:shortcode_attr readonly]
    </div>
    <div class=”clear”></div>
    <div class=”tktinput”>
    <b>Part not replaced (optional)</b>
    <i>Note: Only select No for this part if it’s going back to the warehouse for warranty/inspection, but has not been replaced at site e.g Batteries</i>
    [checkbox partreplaced label_first use_label_element exclusive default:1 “Yes” “No”]
    </div>

    <div class=”clear”></div>
    <div class=”tktinput”>
    [submit id:addparts class:ui-button class:ui-widget class:ui-corner-all class:footer “Add Part”]
    </div>

    <div class=”clear”></div>
    [response]

    Plugin Author Aurovrata Venet

    (@aurovrata)

    the error is in your double quotes which are not being recognised by the CF7 plugin tag mnager,

    [dynamic_select* searchpart class:select2 “source:filter”]

    try this,

    [dynamic_select* searchpart class:select2 "source:filter"]

    notice the double quotes are vertical, the ones in your form are slanted. How did you form these quotes? Did you not create the form in the form editor using the CF7 tag manager?

    Thread Starter nsaint

    (@nsaint)

    The double quotes were correct, it just changed pasting it into the post.

    I am still having the issue, but I think I solved it. The form is a legacy one, when I create the tag in a new form it works correctly. So will have to recreate the form again in a new one.

    Thanks for your help.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    The form is a legacy one, when I create the tag in a new form it works correctly.

    you can just cut and paste the old form html into the new form and you should be good to go.

    Thread Starter nsaint

    (@nsaint)

    Great, thanks for your help

    Plugin Author Aurovrata Venet

    (@aurovrata)

    you’re wc. Do leave a review when you have a moment to spare

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Uncaught TypeError: cf7sg[fid] is undefined’ is closed to new replies.