Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter kenshin23

    (@kenshin23)

    To follow-up (and to remind myself how CORS works): setting the header on my end (now obviously) doesn’t work, as it’s the server with the util.css (in this case, gstatic.com) the one that should set the header.

    Since the server is the official one for the Google Charts API, there’s no way to set the header or fix the issue by myself, however, I found that if you edit the files visualizer/js/render.js (line 176) and visualizer/js/media.js (line 7) and replace “current” with “43”, the problem goes away, as it’s not loading the latest version of the library, but a previous one which seems to work.

    Hope this helps someone with the same issue.

    kenshin23

    (@kenshin23)

    I know this was 5 months ago, but I just installed this plugin today and ran into the same error.

    The solution is to edit wysiwyg.php inside the main plugin folder, and then change line 134 from this function wpcf7_tg_pane_wysiwyg( &$contact_form ) { to this function wpcf7_tg_pane_wysiwyg( $contact_form ) {.

    I also changed some plugin options to have the full editor instead of the “teeny” one, but that’s outside the scope of the thread.

    Thread Starter kenshin23

    (@kenshin23)

    If I use the default structure, the previous link becomes http://www.arcticspascore.com/?page_id=12734 and is accessible, both from the frontend and admin pages.

    However, if I then switch to “Post name” permalinks, it gives the 404 error again.

    Thread Starter kenshin23

    (@kenshin23)

    Thanks for the suggestion, this worked perfectly! Marking this as resolved.

    I have the same issue with a freshly installed plugin, using WP 3.6.1.

    However, on the Chrome javascript console, when I click on the “Add To Post” Button, the following error appears:

    Uncaught ReferenceError: THEME_URI is not defined jquery.prettyPhoto.js:1
    a.fn.prettyPhoto jquery.prettyPhoto.js:1
    (anonymous function) script.js:159
    c jquery.js?ver=1.10.2:3
    p.fireWith jquery.js?ver=1.10.2:3
    x.extend.ready jquery.js?ver=1.10.2:3
    q

    I hope this helps as well.

    Thread Starter kenshin23

    (@kenshin23)

    For the record, I ended up doing this with plain ol’ jQuery in the mean time, like this:

    In CF7:

    [select* vehicle-type id:cf7form-vehicle-type class:select-vehicle-type include_blank "Cars" "Trucks" "Bikes" "Buses" "Heavy Machinery"]
    [select* vehicle-make id:cf7form-vehicle-make class:select-vehicle-make include_blank]
    [select* vehicle-model id:cf7form-vehicle-model class:select-vehicle-model include_blank]

    In js file included from template:

    //Clean every select's options:
    //Optional: fill first option with blank value.
    function clearSelect(selector_str, fillBlank) {
    	fillBlank = (typeof fillBlank === "undefined") ? true : fillBlank;
    
    	jQuery(selector_str).empty();
    	if(fillBlank) {
    		jQuery(selector_str).append('<option value="">---</option>');
    	}
    }
    
    //Functions for the form's selects:
    jQuery(document).ready(function(){
    
        if (jQuery('#cf7form-vehicle-type').length > 0) {
            jQuery('#cf7form-vehicle-type').change(function(){
                jQuery('#cf7form-vehicle-make').attr('disabled','disabled');
                jQuery('#cf7form-vehicle-model').attr('disabled','disabled');
                clearSelect('#cf7form-vehicle-make');
                clearSelect('#cf7form-vehicle-model');
                var vehicle_type = jQuery('#cf7form-vehicle-type').val();
    
                jQuery.get(
                    'select-ajax.php',
                    {level: 'make', type_selected: vehicle_type},
                    'json'
                ).done(function( data ){
                    var optArray = JSON.parse(data);
                    var select = jQuery('#cf7form-vehicle-make');
                    var i;
                    if(select.prop) {
                        var options = select.prop('options');
                    }
                    else {
                        var options = select.attr('options');
                    }
    
                    for (i = 0; i < optArray.length; ++i) {
                        options[options.length] = new Option(optArray[i], optArray[i]);
                    }
                });
                jQuery('#cf7form-vehicle-make').removeAttr('disabled');
                jQuery('#cf7form-vehicle-model').removeAttr('disabled');
            });
        }
    
        if (jQuery('#cf7form-vehicle-make').length > 0) {
            jQuery('#cf7form-vehicle-make').change(function(){
                jQuery('#cf7form-vehicle-model').attr('disabled','disabled');
                clearSelect('#cf7form-vehicle-model');
                var vehicle_type = jQuery('#cf7form-vehicle-type').val();
                var vehicle_make = jQuery('#cf7form-vehicle-make').val();
    
                jQuery.get(
                    'select-ajax.php',
                    {level: 'model', type_selected: vehicle_type, make_selected: vehicle_make},
                    'json'
                ).done(function( data ){
                    var optArray = JSON.parse(data);
                    var select = jQuery('#cf7form-vehicle-model');
                    var i;
                    if(select.prop) {
                        var options = select.prop('options');
                    }
                    else {
                        var options = select.attr('options');
                    }
    
                    for (i = 0; i < optArray.length; ++i) {
                        options[options.length] = new Option(optArray[i], optArray[i]);
                    }
                });
    
                jQuery('#cf7form-vehicle-model').removeAttr('disabled');
            });
        }
    
        //Fill year select with series of years starting with current year + 1 to 1950
        if (jQuery('#cf7form-vehicle-year').length > 0) {
            var year_select = jQuery('#cf7form-vehicle-year'), year = new Date().getFullYear() + 1;
            if(year_select.prop) {
                var options = year_select.prop('options');
            }
            else {
                var options = year_select.attr('options');
            }
            do {
                options[options.length] = new Option(year, year);
                year--;
            } while(year >= 1950);
        }
    })

    Ajax-select.php (simplified):

    <?php
    //Data array included here:
    require_once("vehicle-data.php");
    
    //AJAX-provided values:
    $level = (isset($_GET['level']) ? $_GET['level'] : "");
    $type_selected  = (isset($_GET['type_selected'])  ? $_GET['type_selected']  : "");
    $make_selected  = (isset($_GET['make_selected'])  ? $_GET['make_selected']  : "");
    
    if( $level == "" ):
        echo json_encode(array("Error" => "Array level to return was not set."));
        return false;
    endif;
    
    if( $level == "make"):
        if( $type_selected == "" ):
            echo json_encode(array("Error" => "A necessary select option was not obtained."));
            return false;
        endif;
    elseif ( $level == "model"):
        if( $type_selected == "" or $make_selected == "" ):
            echo json_encode(array("Error" => "A necessary select option was not obtained."));
            return false;
        endif;
    else:
        echo json_encode(array("Error" => "Incorrect level set."));
        return false;
    endif;
    
    //Source array filtered to return requested data:
    switch($level):
        case "make":
            $sublevel_array = $options[$type_selected];
            $return_data    = array_keys($sublevel_array);
            break;
        case "model":
            $sublevel_array = $options[$type_selected][$make_selected];
            $return_data    = array_values($sublevel_array);
            break;
        default:
            echo json_encode(array("Error" => "Array sublevel to return not set."));
            return false;
    endswitch;
    
    echo json_encode($return_data);
    ?>

    I hope this helps someone. I know the code might not be the most efficient one, but it’s working ok so far.

    Thread Starter kenshin23

    (@kenshin23)

    Any ideas, please?

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