Now a new error occurs much earlier in the form, when trying to advance from the “Race 1” (3rd) page of the form: error message says “This field is required. Please enter the post title.” This didn’t happen before. The form creates 5 posts (custom posts) as part of the registration process. The post title is created during submission via a custom plugin that uses some of the field entries (plugin created via guidance from this forum). It was working perfectly for over 2 years.
There are a number of customizations (mu-plugins) that were created with guidance from this forum, so I’m wondering if some of that custom code has become obsolete after plugin updates.
We have a similar form that is not a registration form, that also creates up to 5 of the same type of custom post, and the same issue now happens there after trying to advance past Race 1. “This field is required. Please enter the post title.”
Another form we have that submits only a single post IS working, no error about required post title. It’s creating the same custom post type and auto creating the title via a mu-plugin. But that is a one-page form. So maybe it’s related to multi page forms?
Here are the customizations (mu-plugins) being used. Note the form ID is 513.
Creating the post titles:
<?php
/**
* Plugin Name: Forminator Results Auto Post Title for Registration Form
* Description: Creates results post title from submitter name and date/time of submission.
* Author: WPMU Dev plus customizations by Teresa Nightingale
*/
add_filter( 'forminator_prepared_data', 'wpmudev_update_post_data_fields_reg', 10, 2 );
function wpmudev_update_post_data_fields_reg( $prepared_data, $module_object ){
if( 513 != $module_object->id ){
return $prepared_data;
}
if( isset( $prepared_data[ 'postdata-1' ] ) ){
if( isset( $prepared_data[ 'postdata-1' ][ 'country' ] ) ){
$countryname1 = get_term( $prepared_data[ 'postdata-1' ][ 'country' ] )->name;
} else {
$countryname1 = '';
}
$prepared_data[ 'postdata-1' ][ 'post-title' ] = $countryname1 . ' race result for ' . $prepared_data[ 'name-1' ][ 'first-name' ] . ' ' . $prepared_data[ 'name-1' ][ 'last-name' ];
}
if( isset( $prepared_data[ 'postdata-2' ] ) ){
if( isset( $prepared_data[ 'postdata-2' ][ 'country' ] ) ){
$countryname2 = get_term( $prepared_data[ 'postdata-2' ][ 'country' ] )->name;
} else {
$countryname2 = '';
}
$prepared_data[ 'postdata-2' ][ 'post-title' ] = $countryname2 . ' race result for ' . $prepared_data[ 'name-1' ][ 'first-name' ] . ' ' . $prepared_data[ 'name-1' ][ 'last-name' ];
}
if( isset( $prepared_data[ 'postdata-3' ] ) ){
if( isset( $prepared_data[ 'postdata-3' ][ 'country' ] ) ){
$countryname3 = get_term( $prepared_data[ 'postdata-3' ][ 'country' ] )->name;
} else {
$countryname3 = '';
}
$prepared_data[ 'postdata-3' ][ 'post-title' ] = $countryname3 . ' race result for ' . $prepared_data[ 'name-1' ][ 'first-name' ] . ' ' . $prepared_data[ 'name-1' ][ 'last-name' ];
}
if( isset( $prepared_data[ 'postdata-4' ] ) ){
if( isset( $prepared_data[ 'postdata-4' ][ 'country' ] ) ){
$countryname4 = get_term( $prepared_data[ 'postdata-4' ][ 'country' ] )->name;
} else {
$countryname4 = '';
}
$prepared_data[ 'postdata-4' ][ 'post-title' ] = $countryname4 . ' race result for ' . $prepared_data[ 'name-1' ][ 'first-name' ] . ' ' . $prepared_data[ 'name-1' ][ 'last-name' ];
}
if( isset( $prepared_data[ 'postdata-5' ] ) ){
if( isset( $prepared_data[ 'postdata-5' ][ 'country' ] ) ){
$countryname5 = get_term( $prepared_data[ 'postdata-5' ][ 'country' ] )->name;
} else {
$countryname5 = '';
}
$prepared_data[ 'postdata-5' ][ 'post-title' ] = $countryname5 . ' race result for ' . $prepared_data[ 'name-1' ][ 'first-name' ] . ' ' . $prepared_data[ 'name-1' ][ 'last-name' ];
}
return $prepared_data;
}
Fix bug with missing custom taxonomy in stored submissions:
<?php
/**
* Plugin Name: Forminator Postdata Submission Country
* Description: Fixes bug where custom taxonomy term Country is missing from stored submissions. Works for single or multiple country selections.
* Author: WPMU Dev
*/
add_filter( 'forminator_entry_meta_value_to_string', 'wpmudev_show_post_country_entry', 10, 5 );
function wpmudev_show_post_country_entry( $string_value, $field_type, $meta_value, $allow_html, $truncate ){
if( $field_type == 'postdata' ){
if( ! empty( $meta_value['postdata'] ) ){
if( !empty( $meta_value['value']['country'] ) ){
$post_country = $meta_value['value']['country'];
$the_countries = '';
$countegories = 0;
$single_label = esc_html__( 'Country', 'forminator' );
if ( is_array( $post_country ) ) {
foreach( $post_country as $country ) {
$countries[] = get_the_category_by_ID( $country );
}
$countegories = count( $countries );
$the_countries = implode( '; ', $countries );
} else {
$the_countries = get_the_category_by_ID( $post_country );
}
if ( $allow_html ) {
$value = '<hr>';
if ( is_array( $post_country ) ) {
$value .= '<strong>' . esc_html( _n( 'Country', 'Countries', $countegories, 'forminator' ) ) . ':</strong> ';
} else {
$value .= '<strong>' . $single_label . ':</strong> ';
}
$value .= $the_countries;
} else {
$value .= $single_label . ': ';
$value .= $the_countries . ' | ';
}
$value .= '<hr>';
$string_value .= $value;
}
}
}
return $string_value;
}
Fix bug where custom taxonomy is missing from email notifications:
<?php
/**
* Plugin Name: Forminator Postdata Submission Fix for Results
* Description: Fixes bug where custom taxonomy is missing from the email notifications using postdata fields - for forms collecting race results. Up to 5 results at a time.
* Author: WPMU Dev
*/
add_filter( 'forminator_replace_form_data', 'wpmudev_post_data_macros_results', 10, 3 );
function wpmudev_post_data_macros_results( $content, $data, $original_content ){
if( !( $data['form_id'] == 576 || $data['form_id'] == 513 || $data['form_id'] == 677 || $data['form_id'] == 1373 ) ){ // it's not one of the forms that collect race results post data
return $content;
}
if( !isset( $data['postdata-1'] ) ){
return $content;
}
if( strpos( $content, '{post-term}' ) !== false ){
if( isset( $data['postdata-1']['country'] ) ){
$term_name = get_term( $data['postdata-1']['country'] )->name;
$content = str_replace( '{post-term}', $term_name, $content );
}
}
if( !isset( $data['postdata-2'] ) ){
return $content;
}
if( strpos( $content, '{post-term-2}' ) !== false ){
if( isset( $data['postdata-2']['country'] ) ){
$term_name2 = get_term( $data['postdata-2']['country'] )->name;
$content = str_replace( '{post-term-2}', $term_name2, $content );
}
}
if( !isset( $data['postdata-3'] ) ){
return $content;
}
if( strpos( $content, '{post-term-3}' ) !== false ){
if( isset( $data['postdata-3']['country'] ) ){
$term_name3 = get_term( $data['postdata-3']['country'] )->name;
$content = str_replace( '{post-term-3}', $term_name3, $content );
}
}
if( !isset( $data['postdata-4'] ) ){
return $content;
}
if( strpos( $content, '{post-term-4}' ) !== false ){
if( isset( $data['postdata-4']['country'] ) ){
$term_name4 = get_term( $data['postdata-4']['country'] )->name;
$content = str_replace( '{post-term-4}', $term_name4, $content );
}
}
if( !isset( $data['postdata-5'] ) ){
return $content;
}
if( strpos( $content, '{post-term-5}' ) !== false ){
if( isset( $data['postdata-5']['country'] ) ){
$term_name5 = get_term( $data['postdata-5']['country'] )->name;
$content = str_replace( '{post-term-5}', $term_name5, $content );
}
}
return $content;
}
Convert custom taxonomy simple dropdown select to search box type select:
<?php
/**
* Plugin Name: Forminator Search Box for Countries in Postdata
* Description: converts simple select dropdown for country taxonomy in post-data field to search box type select.
* Author: WPMU Dev
*/
add_filter( 'forminator_field_postdata_country', 'wpmudev_allow_search_taxonomy_data', 10, 1 );
function wpmudev_allow_search_taxonomy_data( $html ) {
$html = str_replace( 'type="select"' , 'type="select" data-search="true"', $html );
$html = str_replace( 'placeholder=""' , 'data-placeholder="--Select a Country--"', $html );
$html = str_replace( '<option value="288"' , '<option></option> <option value="288"', $html );
return $html;
}
]]>I’m looking for a solution which will allow me to apply multi-page functionality on my existing forms without having to create them again.
From what I searched online no plugin is capable of that, but I’m probably wrong. Please let me know if there are plugins.
Additionally, I don’t mind using PHP or Elementor HTML/JS to do that but I will need some guidance and if that process will cause any performance or data-loss issues.
Thanks for your time,
SSLV
Is there a way to directly move to the next page on WPForms Multi Page forms when user click on an option on the multiple choice (radio button), and hide the next button?
Thank you
]]>I saw a similar question asked a few years ago, and was wondering if that has been built in yet?
]]>Let me explain briefly, I have a need for a multi-part (multi-page) form for processing Lease Applications for an Apartment Community. I currently have 4 Groups setup (one Group for each page of the multi-page form as instructed above). I have 94 Data Fields spanning these 4 Groups. However, I only have 3 test records in the DB though (very little actual data yet as we are developing this).
My client is using FlyWheel Hosting, which doesn’t seem so bad (though I typically use GoDaddy myself and for my clients). Anyway, the site is using Elegant Themes Divi Builder, and it has a Child Theme (for this specific instance of the template – as it required customization of course).
Anyway, this morning I needed to add the final 12 Fields into the last Group (lease_agreement_form_4), and upon creating the 10th data field (approximately the 92nd field created overall), I received “error 28” (which typically indicates an issue with server memory). I checked and we were no where near the limit for this account on server space, so I contacted their support. The end result was that I was advised to “Flush the Cache” on the site and hope it clears up the issue (they have a “Flush Cache” function on the back end).
After Flushing the cache, I could no longer log into the site (wp-admin), so I contacted support again and they had to escalate the issue. About an hour later they resolved the issue and notified me that it was an issue on their end (they had to clean some things up).
So, when I logged into wp-admin, all seemed well. I added the remaining data fields to the 4th Group I had created, and then I went to check the multi-page form (which had been working previous to all of the issues noted above). Well, the form is no longer working, as it loops from the first Page to the same first Page (never goes to the next page, even though I have the action set properly – see next).
This is what the first Page loads –
[pdb_signup template=custom groups=”lease_agreement_form” action=”lease-agreement-application-page-2-a” submit_button=”Next”]
(I actually changed the page name from “lease-agreement-application-page-2” to “lease-agreement-application-page-2-a” in an attempt to resolve this issue. The rest of the pages do not end with a letter like this second page does.)
You can test this by manually entering the URL for page 2 (https://crittendenway.com/lease-agreement-application-page-2/). However, the first page of the form will NOT load the 2nd page anymore (as I stated, it was working earlier today).
What can I check to get this functioning once again? Very frustrating, and unsure what to try next.
Thanks in advance for any input!
Colin
]]>