我有一個複雜的Gravity Form內置,它有10頁。我使用字段來構建一個「字符串」,然後根據用戶在表單中的選擇,匹配CPT名稱以獲取元數據以顯示選擇內容。重力形式多頁丟失POST值
我有一個字段沒有在POST中保留它的值。當我選擇頁面上的值時,我可以看到它,然後當我點擊下一頁時,值仍然存在。但是,在兩頁之後,值(和字段)從POST消失。
這是我放在一起的函數,它構建了我的產品字符串。
add_filter('gform_pre_render_12', 'display_choice_result');
function display_choice_result($form) {
$current_page = GFFormDisplay::get_current_page($form['id']);
$html_content = "";
$prod_string = "";
if ($current_page >= 10) {
foreach ($form['fields'] as &$field) {
// Check for a class of "product-builder-item" on the field
// I use this as another way to denote what fields to add to string
if (strpos($field->cssClass, 'product-builder-item') === false) {
continue;
}
//gather form data to save into html field (Field ID 14 on Form ID 12)
//exclude page break and any hidden fields
if ($field->id != 14 && $field->type != 'page') {
$is_hidden = RGFormsModel::is_field_hidden($form, $field, array());
$populated = rgpost('input_' . $field->id);
// Make sure the field we are getting the value from is not hidden and has a value
if (!$is_hidden && $populated !='') {
$html_content .= '<li>' . $field->label . ': ' . rgpost('input_' . $field->id) . '</li>';
$prod_string .= rgpost('input_' . $field->id);
}
}
}
// Do a bunch of stuff here with the $prod_string variable
// ...
// ...
// ...
}
return $form;
}
截圖顯示相關的帖子disappearing..The POST場input_22
與
值這是一個網頁後,我從外地
選擇這是兩個後的頁面,
以前任何人遇到過這種情況,或者有任何想法,爲什麼它會消失?
謝謝。
你能解決這個問題嗎?遇到類似的情況。 – kisabelle