Skip Navigation

[Resolved] Form type and post type do not match (urgent live site)

This support ticket is created 3 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 reply, has 1 voice.

Last updated by AndreG3332 3 years, 3 months ago.

Author
Posts
#2158257
image 4.png
image 5.png
image 2.png
image 1.png

We are getting the error "Form type and post type do not match" on a multistep form

we have a post form id 1437 Image 1 First form. "Update Editors Profile Step 01 "

the form editor code is:

[credform]
[cred_field field='form_messages' class='alert alert-warning']
<div class="container">	
	<div class="contentcontainer">
  <div class="form-group fn">
		<label for="%%FORM_ID%%_first_name">
          	[cred_i18n name='first_name-label']
          		First Name
          	[/cred_i18n]
    	</label>
			[cred_field field='first_name' force_type='field' placeholder = "First Name" class='form-control' output='bootstrap']
	</div>
  
	<div class="form-group sn">
			<label for="%%FORM_ID%%_surname">
              	[cred_i18n name='surname-label']
              		Surname
              	[/cred_i18n]
      		</label>
				[cred_field field='surname' placeholder="Your Surname" force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group gender">
		<label for="%%FORM_ID%%_gender-test">
              	[cred_i18n name='gender-test-label']
          			Gender
          		[/cred_i18n]
      	</label>
              	[cred_field field='gender-test' force_type='field' class='form-control' output='bootstrap']
  	</div>
  </div>
  	<div class="containerbutton">
      <div class="subbtn">
				[cred_field field='form_submit' output='bootstrap' value='Submit' class='btn btn-primary btn-lg']
	</div>
      
  </div>  
</div>
  [/credform]

the css styling is

.container{
			display:flex;
            flex-direction:column;
            background-color:#27A189;
            width:1200px;
            padding:100px 20% 100px 20%;   
            justify-content: center;
            align-items: center;
  }

.form-group.sn label, .form-group.fn label{
			display: none;
}
.form-group.gender{
			color:#fff;
}

::placeholder{
	color:#fff;
}
.contentcontainer{
	width:50%;
  	  	

}

.form-group{
	width:100%;
  	Padding: 0 10% 0 10%;
  	margin: 20px 0 20px 0;
}


input[type=email], input[type=number], input[type=password], input[type=reset], input[type=search], input[type=tel], input[type=text], input[type=url], select, textareat {
  height: auto;
        margin-bottom:20px;
		border-width: 2px;
        border-style: solid;
        border-color: #fff;
        border-radius: 50px;
        box-shadow: none;
        box-sizing: border-box;
        transition: all .2s linear;
        font-family: 'Roboto',sans-serif;
        font-weight: 400;
        font-size: 15px;
        font-size: 1rem;
        background-color:rgba(255, 255, 255, .15);
}

input[type=email]:hover, input[type=number]:hover, input[type=password]:hover, input[type=reset]:hover, input[type=search]:hover, input[type=tel]:hover, input[type=text]:hover, input[type=url]:hover, select:hover, textareat:hover{
  	border-width: 2px;
    border-style: solid;
    border-color: #fff;
    border-radius: 50px;
    background-color:rgba(255, 255, 255,0);
}
input[type=email]:focus, input[type=number]:focus, input[type=password]:focus, input[type=reset]:focus, input[type=search]:focus, input[type=tel]:focus, input[type=text]:focus, input[type=url]:focus, select:focus, textareat:focus{ 
  	background-color: #0D7B6A;
 	border-width: 2px;
    border-style: solid;
    border-color: #fff !important;
    border-radius: 0px !important;
}
input[type=email]:visited, input[type=number]:visited, input[type=password]:visited, input[type=reset]:visited, input[type=search]:visited, input[type=tel]:visited, input[type=text]:visited, input[type=url]:visited, select:visited, textareat:visited {
  
  	background-color: #0D7B6A;
 	border-width: 2px;
    border-style: solid;
    border-color: #fff !important;
    border-radius: 0px !important;
  	color:#fff!important;
}

input[type="submit"]{
	height: auto;
    border-width: 2px;
    border-style: solid;
    border-color: #fff;
    border-radius: 50px;
   	padding: 15px 100px 15px 100px;
   	background-color: rgba(255,255,255,0.15);
   	
   
}

input[type="submit"]:hover{
	background-color:rgba(255,255,255,0);
	border-width: 2px;
    border-style: solid;
    border-color: #fff;  
}


.page [type="submit"]:focus {
	background-color: rgba(0, 0, 0, 0);
	border-color: #fff;
}

This form is then used in a template :
Editors profile completeness form 1550
image 2

This template is then allocated to a page "profile-completeness"
with the "Form type and post type do not match" error.
The back end on-page is image 3

This is the function file, the first two functions for the first two post forms.

/** Multistep form "Editor" profile completeness for 9 pages*/

add_filter('cred_success_redirect', 'step2b_redirect_func',10,3);
function step2b_redirect_func($url, $post_id, $form_data)
{
    if ($form_data['id']==1437)
    {
       	$arr = array('content-template-id'=>1551); /*the step 2 template ID*/
        $url = add_query_arg($arr, $url);
    }
    return $url;
}

add_filter('cred_success_redirect', 'step3b_redirect_func',10,3);
function step3b_redirect_func($url, $post_id, $form_data)
{
    if ($form_data['id']==1439)
    {
       	$arr = array('content-template-id'=>1552); /*the step 3 template ID*/
        $url = add_query_arg($arr, $url);
    }
    return $url;
}


Image three is the screen print of the page itself that uses the template for the layout.

#2158385

My issue is resolved now. Thank you!