• Resolved albertomadrid

    (@albertomadrid)


    Hello,

    I’m having problems when I try to use this _ (underscore) symbol before a variable name to pass it to an URL as a http://www.test.com/?_variable=0 parameter.

    The website I need to pass arguments of my CF7 form requires this _variable, and is not possible to call the site without this _(underscore) symbol before the variable, like this: http://www.test.com/?variable=0 because backend at destination just recognise _variable as key parameter. Others variables like http://www.test.com/?works=nice has not any problem.

    It’s like CF7 delete ‘_’ simbol. Hoping you could help me please…

Viewing 1 replies (of 1 total)
  • Thread Starter albertomadrid

    (@albertomadrid)

    I solved it adding _variable=value into plugin code (within wpcf7-redirect-script.js) file as detailed here:

    // Build http query
    if ( form.http_build_query ) {
    temp_http_query = jQuery.param( event.detail.inputs, true );
    http_query = temp_http_query.replace(new RegExp(‘\\+’, ‘g’), ‘%20’);
    redirect_url = redirect_url + ‘?_variable=0&‘ + decodeURIComponent(http_query);
    } else if ( form.http_build_query_selectively ) {
    http_query = ‘?_variable=0&‘;
    selective_fields = form.http_build_query_selectively_fields.split(‘ ‘).join(”);
    event.detail.inputs.forEach( function(element, index) {
    if ( selective_fields.indexOf( element.name ) != -1 ) {
    http_query += element.name + ‘=’ + element.value + ‘&’;
    }
    });

    http_query = http_query.slice(0, -1);
    redirect_url = redirect_url + decodeURIComponent(http_query);
    }

Viewing 1 replies (of 1 total)

The topic ‘Problems with _ (underscore) symbol’ is closed to new replies.