确定我是否可以根据选择字段的值更改隐藏输入字段(CF7 - 动态文本扩展名)的值。
这是获取名为stampfield
的选择字段值的函数。
function dynamic_stamp_field_values ( $tag, $unused ) {
if ( $tag['name'] != 'stampfield' )
return $tag;
$args = array (
'numberposts' => -1,
'post_type' => 'stamp',
'orderby' => 'title',
'order' => 'ASC',
);
$custom_posts = get_posts($args);
if ( ! $custom_posts )
return $tag;
foreach ( $custom_posts as $custom_post ) {
$tag['raw_values'][] = $custom_post->post_title;
$tag['values'][] = $custom_post->post_title;
$tag['labels'][] = $custom_post->post_title;
}
return $tag;
}
add_filter( 'wpcf7_form_tag', 'dynamic_stamp_field_values', 10, 2);
我的表单中的代码看起来像这样:
<div class="form-group row">
<label class="col-md-3">Mærke</label>
<div class="col-md-9">
[select stampfield class:form-control include_blank]
</div></div>
代码看起来像这样:
if stampfield == blank&gt;隐藏字段的值是200其他225
我该怎么做?