• Resolved waltthomas

    (@waltthomas)


    Hi,

    I’m dynamicaly populating a select field with custom raw values on two form, on the first form the correct labels (after pipe) is going in the mail.
    With the same code and content the second form is getting the value (before pipe).
    Using the same markup :
    <label>Séance*</label>[select* seance class:custom_select]

    With the following code :
    `if($tag[‘raw_name’] == ‘offre_emploi’) {

    $offres = get_offres();

    if(count($offres)<1) return $tag;

    foreach ($offres as $post){

    $tag[‘raw_values’][] = $post->ID .’|’. $post->post_title;
    }

    $pipes = new WPCF7_Pipes($tag[‘raw_values’]);

    $tag[‘values’] = $pipes->collect_befores();
    $tag[‘labels’] = $pipes->collect_afters();
    $tag[‘pipes’] = $pipes;

    } elseif ($tag[‘raw_name’] == ‘seance’) {

    $seances = get_field(‘seances’,$_GET[‘fo’]);
    foreach ($seances as $key => $seance) {
    if( time() < strtotime($seance[‘date_start’])){
    $type = event_date_type($seance[‘date_start’], $seance[‘date_end’]);
    $formated_dates = format_dates($type,strtotime($seance[‘date_start’]),strtotime($seance[‘date_end’]));

    $tag[‘raw_values’][] = strtotime($seance[‘date_start’]).’|’.$formated_dates;
    }
    }

    $pipes = new WPCF7_Pipes($tag[‘raw_values’]);

    $tag[‘values’] = $pipes->collect_befores();
    $tag[‘labels’] = $pipes->collect_afters();
    $tag[‘pipes’] = $pipes;

    } elseif ($tag[‘raw_name’] == ‘formation_title’) {

    $formation_title = get_the_title($_GET[‘fo’]);

    $tag[‘raw_values’][] = $formation_title;
    $tag[‘values’][] = $formation_title;
    $tag[‘labels’][] = $formation_title;
    }
    return $tag;

    Thanks in advance

  • The topic ‘Problemes with pipes’ is closed to new replies.