【发布时间】:2016-12-15 18:54:28
【问题描述】:
我尝试搜索一个与我在这里提出的问题类似的问题,但我找不到。如果已经有人提出并回答了这样的问题,我深表歉意。
我正在尝试使用我自己的 html 和 css 替换重力表单进度条。我可以使用 Gravity Forms 提供的 gform_progress_bar 过滤器来做到这一点。
我现在遇到的问题是,一旦我完成了对表单的输入(我在表单中使用了 Ajax),我的确认现在不会显示。如果我注释掉过滤器并填写表格,则会显示确认信息。
我再次想弄清楚为什么我的确认消息没有显示,或者我怎样才能正确检索它。
这是我的代码:
function request_quote_progressbar( $progress_bar, $form, $confirmation_message ) {
$output = '';
$output .= '<div class="meter animate">';
$output .= '<span class="progress-one">';
$output .= '<span>';
$output .= '<div id="percentage">0%</div>';
$output .= '</span>';
$output .= '</span>';
$output .= '</div>';
$progress_bar = $output;
return $progress_bar;
}
add_filter( 'gform_progress_bar_2', 'request_quote_progressbar', 10, 3 );
现在,当我对此进行测试时,我的默认确认再次不会显示,但如果我注释掉 //add_filter( 'gform_progress_bar_2', 'request_quote_progressbar', 10, 3);,则默认进度条会与表单一起显示并显示确认消息。
我尝试error_log( print_r( $confirmation_message, true ) );但它会出现空白。我什至做了error_log( print_r( $form, true ) ); 只是为了看看是否有确认消息,但它是这样列出的:
[confirmations] => Array
(
[58518896a4081] => Array
(
[id] => 58518896a4081
[name] => Default Confirmation
[isDefault] => 1
[type] => message
[message] => Thank you for your request!We are in the process of reviewing your quote and will be in touch with you within the next few days.
[url] =>
[pageId] => 0
[queryString] =>
[disableAutoformat] =>
[conditionalLogic] => Array
(
)
)
)
【问题讨论】:
-
好的,所以我现在通过这样做收到了确认消息:我想出了自己的问题来获得确认消息。我所做的如下:` $confirmation_message = $form['confirmations']; foreach( $confirmation_message as $key => $value ) { error_log( print_r( $value['message'], true ) ); } ` 打印出我的确认。所以我把它作为我的
$confirmation_message,但是当我完成表格时它仍然没有显示确认消息。
标签: php wordpress progress-bar gravity-forms-plugin