• Hi,

    I found a possible bug inside the code that manages pipes within data in dropdowns.

    For example, your dropdown example from Selectable Recipient doesn’t work as expected.

    [select your-recipient "CEO|[email protected]"
                        "Sales|[email protected]"
                        "Support|[email protected]"]

    Renders this code:

    <select name="your-recipient" class="wpcf7-form-control wpcf7-select" aria-invalid="false">
    <option value="CEO">CEO</option>
    <option value="Sales">Sales</option>
    <option value="Support">Support</option>
    </select>

    When I think it should render this code:

    <select name="your-recipient" class="wpcf7-form-control wpcf7-select" aria-invalid="false">
    <option value="[email protected]">CEO</option>
    <option value="[email protected]">Sales</option>
    <option value="[email protected]">Support</option>
    </select>

    I fixed this on /includes/shortcodes.php file, line 147 to 155. Replacing this code:

    if ( WPCF7_USE_PIPE ) {
    	$pipes = new WPCF7_Pipes( $scanned_tag['raw_values'] );
    	$scanned_tag['values'] = $pipes->collect_befores();
    	$scanned_tag['pipes'] = $pipes;
    } else {
    	$scanned_tag['values'] = $scanned_tag['raw_values'];
    }
    
    $scanned_tag['labels'] = $scanned_tag['values'];

    With this:

    if ( WPCF7_USE`_PIPE ) {
    $pipes = new WPCF7_Pipes( $scanned_tag[‘raw_values’] );
    $scanned_tag[‘values’] = $pipes->collect_afters();
    $scanned_tag[‘labels’] = $pipes->collect_befores();
    $scanned_tag[‘pipes’] = $pipes;
    } else {
    $scanned_tag[‘values’] = $scanned_tag[‘raw_values’];
    $scanned_tag[‘labels’] = $scanned_tag[‘values’];
    }`

    Do you agree with that?

Viewing 1 replies (of 1 total)
  • I stumbled int the same issue. I have select set as

    [select* diploma include_blank "Диплома 1|diploma_1" "Диплома 2|diploma_2"]

    and it does not use content after pipe for select at all.

    This seems to be a bug. Your solution seems fine for my case. I hope developer will include this in main code.

    However for emailing, this is not good solution, as it does not protect email addresses from harvesting.

Viewing 1 replies (of 1 total)
  • The topic ‘Dropdown problem with pipes’ is closed to new replies.