Skip Navigation

[Resolved] Invalid Form Submission (maybe a file has a size greater than allowed)

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.

Tagged: 

This topic contains 8 replies, has 2 voices.

Last updated by alfredoV 6 years ago.

Assigned support staff: Beda.

Author
Posts
#333310
example error.png

"Invalid Form Submission (maybe a file has a size greater than allowed)"

All but one Cred Add form produces this error - However the error only displays in Firefox browers.
In Chrome, Internet Explorer and Safari it produces a "white page".

You must be logged in to test usng this link: hidden link
The functions php for this form is:

add_action('cred_save_data', 'Vendor_add_func',10,2);
function Vendor_add_func($post_id, $form_data)
{
    if ($form_data['id']==26088)    // if vendor add form
    {
       $title = get_the_title($post_id);
       update_post_meta($post_id, 'wpcf-vendor-name', $title);    // update vendor name
    }
}

This is the code for Cred form "Vendor Add" ID=26088 :

[credform class="cred-form cred-keep-original"]

	[cred_field field="form_messages" value=""]
[wpv-if evaluate="'[wpv-current-user info="login"]' = 'cmvasq@gmail.com'"]<label class="cred-label">Hello Charlene</label>[/wpv-if]
[wpv-if evaluate="'[wpv-current-user info="login"]' = 'Kimbav'"]<label class="cred-label">Hello Kimba</label>[/wpv-if]
[wpv-if evaluate="'[wpv-current-user info="login"]' = 'Len'"]<label class="cred-label">Hello Leonard</label>[/wpv-if]
[wpv-post-today]
     <table width="100%">
        <tbody>    
          <tr>   
	      <td class="cred-field cred-field-post_title">
		<label class="cred-label">Vendor Name</label>
		[cred_field field="post_title" post="vendor" value="" urlparam=""]
	      </td>

	      <td class="cred-field cred-field-account-number">
			<label class="cred-label">Account Number</label>
			[cred_field field="account-number" post="vendor" value="" urlparam=""]
	      </td>
              <td width="41%"></td>

          </tr>
        </tbody></table> 

     <table width="100%" border="1">
        <tbody>    
          <tr>    
	      <td class="cred-field cred-field-contact-name">
			<label class="cred-label">Contact Name</label>
			[cred_field field="contact-name" post="vendor" value="" urlparam=""]
	      </td>
            
	      <td class="cred-field cred-field-contact-email">
			<label class="cred-label">Contact Email</label>
			[cred_field field="contact-email" post="vendor" value="" urlparam=""]
		</td>
     
                        
                <td class="cred-field cred-field-contact-phone">
			<label class="cred-label">Contact Phone</label>
			[cred_field field="contact-phone" post="vendor" value="" urlparam=""]
		</td>
            
		<td class="cred-field cred-field-contact-fax">
			<label class="cred-label">Contact Fax</label>
			[cred_field field="contact-fax" post="vendor" value="" urlparam=""]
		</td>
          </tr>
     </tbody></table> 
                         
                <div class="cred-field cred-field-note-to-vendor">
			<label class="cred-label">Note To Vendor</label>
			[cred_field field="note-to-vendor" post="vendor" value="" urlparam=""]
		</div>      

		<div class="cred-field cred-field-notes-internal">
			<label class="cred-label">Notes Internal</label>
			[cred_field field="notes-internal" post="vendor" value="" urlparam=""]
		</div>
                
	[cred_field field="form_submit" value="Add Vendor" urlparam=""]

[/credform]

The error seems to only happen on CRED Add forms used to add Post Types created using Your Types plugin.

I am able to add a Product (which is a post type not created using Types) using a CRED add form and it works just fine.
I am using the following version:
WP Version 4.3
Toolset Plugins:
Access Version 1.2.6.1
CRED Frontend Editor Version 1.3.6.3
Types Version 1.8.5
WP Views Version 1.10

Thank you for your attention to this issue.

#333335

Thank you for contacting us here in the Support Forum

I will as first enable the private form so you can share the Access Details.

I again tried to reproduce this locally but I can not produce the same error.

The message seems to point to a Field with a File uploaded, but your form does not seem to include any File or Image Field at all.

Once I am logged in, am I allowed to do what follows?:

1. Create a new Custom post Type
2. Create a new, similar form
3. Edit the Theme files to apply your custom code

Please could you provide me the additional Infos, and as well permit me to perform the required steps?

Thank you for your patience.

#333627

Thanks for the Details

It would be good that you first update your Views Plugin to it's latest version. Can you do this please?

❌ Be sure to backup your database first before you proceed! ❌
⌥ You can use a plugin for this if you like.
I often use the Duplicator plugin for this purpose.
See: http://wordpress.org/plugins/duplicator/

I created a fully new Toolset Post Type, a custom Field, a CRED Form and included it all into a page

Here the Links:
hidden link
hidden link
hidden link
hidden link

It triggers the same error. No customization of validation has been coded for this form.

Then I removed the Custom Field from the CRED form and the Types Custom Field group, but on the front end that Custom Field is still visible in the CRED form

That tells me you have a cache enabled that is not emptying correctly.

Still, after Cache emptying, the form can't be submitted, as the same error is triggered.

Unfortunately I can not reproduce this locally.

This must be a problem either surging from Plugins, Theme or server.

To debug this I need either a site's duplicator snapshot or your permission to disable all plugins, change the theme, and see how that goes.

If this is a life site as you say, I would need a sites snapshot if possible.
We usually recommend the free Plugin "Duplicator" for this porpoise.

If you already know how Duplicator works
(http://wordpress.org/plugins/duplicator/),
please skip the following steps and just send me the installer file and the zipped package you downloaded.

★ Duplicator Instructions
hidden link
Send me both files (you probably want to use DropBox, Google Drive, or similar services, as the snapshot file will be quite big)

❌ IMPORTANT ❌
Remember to create or keep an admin account for me before creating the snapshot, or I won't be able to login. You may delete the new admin account once the snapshot has been built.

I will enable your next answer as private so you can provide me the information securely.

You can also perform the tests on your own.

I am 100% sure it is a issue with another Plugin, theme or the Server.

As a last trial we can try to fully reinstall the Toolset Plugins manually, see below ho to do that:

★ INSTRUCTIONS:

❌ Backup your website and database ❌
• Deactivate/Delete the "Installer" plugin (if you have it)
• Deactivate all Toolset plugins
• Login via FTP to your wp-content/plugins folder
• Delete all Toolset Plugins folders
• Go to https://toolset.com/account/downloads/ and download the latest stable Types Plugin, then extract it.
• Upload the plugin via FTP to the wp-content/plugins folder.
⌥ alternatively you could upload the .zip file using Dashboard > Plugins > New > Upload
• Register the Plugin for your site
⌥ you can do that under Dashboard > Types > Settings > Types Tools > Installer
• Download all other needed Plugins
• Activate them in Dashboard > Plugins
This should not generate any problems.

⌥ In case you want to register Toolset Plugins for your site manually please make sure to enter the naked URL of your site in wp-types.com (something like hidden link)

⌥ In the extreme case, please try to register with all non-Toolset Plugins deactivated,
and Theme Toolset Bootstrap enabled.

If that does not work, and you can't afford to disable the Plugins, change the Theme and eventually try on a local server or another live server, I need the Duplicator snapshot.

Please could you provide me the additional Infos?

You can also god ahead and delete all test content I made if you wish, I don't need it anymore for my debugging, but it could be good to keep them for future debugging.

Thank you for your patience.

#333691

Thanks for the Details

Unfortunately the Installer.php file is corrupted. It presents a wrong syntax.

I tried to re-download it from your System but the download fails.

Could you make sure the installer fiel (and also the duplicator file, just in case) are valid and downloadable form your system?

The one in DropBox is corrupted

Please could you provide me the additional Details?

You could alternatively install the Adminer Plugin, and send me a Database Dump of your system.
I can then try to rebuild your site with the Package Files (FTP) and your Database Dump, after changing the URL's in the Database.

Thank you for your patience.

#333727

I deeply apologize, but this Installer fiel is not valid. It presents a corrupted format.

You can see it deploying locally, it will present only "?" and other special characters on your Browser Window instead of the Installer interface.

If you allow me, I would install Adminer and grab a Database Dump

Is this OK for you?

Please could you confirm me the additional Details?

Thank you for your patience.

#333729

yes no problem. sorry for the difficulty.

#333731

I am truly sorry about this troubles.

But your server does produce a invalid Zip of the Database.

If you export your Database as .zip, it gives me a .zip with 0 bytes size, and unzipping it creates again a
.zip.cpgz file, and so on and forth. That can be due to different reasons, but since it's happening to me on all 3 browsers, I suspect a invalid file delivered from the Server itself

Can you try to pull a Database Dump from your cPanel interface?

I suggest as well to contact your server provider regarding above issue.

It is not usual, and it should present no issue to dump a database .zip with adminer.

I left Adminer installed if you want to give a try yourself, but I highly suspect you will get the same result as I did.

Please could you provide me the additional Details?

Thank you for your patience.

#333751

Thanks for the Details

Finally 🙂 I was able to duplicate your site.

The issue is in the Theme.

Here is what I did so far:

1. Disabled all Plugins - no effect
2. Removed all code from wp-config.php (W3TC cache etc) - no effect
3. Applied new slat keys - no effect
4. Changed to Theme Twenty Fourteen : All good

I then re-applied all custom code in your wp-config.php, re-enalbed the Plugins
==> ALL of them, unless wp-super-cache, due to a long list of errors this plugin provides,
and the issue did not come back

Though, re-enabling the THEME, brings the issue back.

Beneath that, a relatively large amount of warnings produced by 3rd Party plugins are present on the site if all plugins are enabled, but that is not the issue here.

All works fine as long your theme is not active.

I see different issues in your Child Theme (wp_oswad_market-child)

1. You use custom short codes with a reserved prefix such as wpv-get-order-balance, wpv-get-return-balance, wpv-post-today
Even if perhaps those code where provided by Supporters in this forum in past, it is not suggested anymore to use wpv- as a prefix

This because it can (and will) conflict with eventual future short codes coming directly from our Plugin.

By today, you can use any short code prefix, you just need to register the short code in Views > Settings > Compatibility > 3rd Party Shortcode arguments

wpv- should not be used anymore (it was necessary some versions ago, but not anymore)

2. I removed all your CRED Custom API codes from the functions.php file of your child theme and all is working great as well with the child theme

I have narrowed the problematic CRED code down to this one:

add_filter('cred_success_redirect', 'return_item_edit_redirect',10,3);
function return_item_edit_redirect($url, $post_id, $form_data)
{
    if ($form_data['id']==50199)   // if return item edit form redirect to vendor-return
    {
        $order_id = get_post_meta($post_id, '_wpcf_belongs_vendor-returns_id', true);  // get order id
        $title = get_the_title($order_id);  // get return title
        $slug = sanitize_title($title);
        $url = '<em><u>hidden link</u></em>'.$slug.'/?cred-edit-form=50197';
        return $url;
    }
}

And this one:

add_filter('cred_success_redirect', 'item_edit_redirect',10,3);
function item_edit_redirect($url, $post_id, $form_data)
{
    if ($form_data['id']==40866)   // if line item edit form redirect to vendor-order
    {
        $order_id = get_post_meta($post_id, '_wpcf_belongs_vendor-orders_id', true);  // get order id
        $title = get_the_title($order_id);  // get order title
        $slug = sanitize_title($title);
        $url = '<em><u>hidden link</u></em>'.$slug.'/?cred-edit-form=40057';
        return $url;
    }
}

EVEN if those codes did NOT apply to my test form at all, removing them avoids the issue.

Both are cred_success_redirect codes.

The second should only apply to a Edit Form:
ID 40866

The first one is a Edit form as well.

I then tried to reproduce this issue, as it seemed, redirection API applied on Edit Forms is somehow not doing what it should (it seems to apply to all forms instead of only the Form ID specified),
==> but locally all works fine if applied to my localhost install

==> I made sure to reproduce your exact CRED form and applied the same exact redirections + code.

So this leads me to suspect, that your CRED forms in question are corrupted, and somehow have wrong data stored.

Please recreate them from scratch after fully deleting them.

Make sure no cached stuff is there as well during this process.

Rewrite (re-insert) the custom code redirections one by one and see if that solves the issue.

I can definitely say, the issue is with the 2 Forms (no matter which CRED form you currently use), and with the 2 Custom Codes you apply to this forms, as illustrated above.

This is a issue with Custom Code, related to a possible cache issue, as example, you could hav invalid / corrupted data in your Database for this 2 forms.

This could be the issue here.

Please let me know if you have further questions regarding the issue mentioned in this Thread

Thank you for your patience.

#333997

Beda thank you very much for the detailed work you've done on this post/issue.
There is no way I could have resolved this with out all the work you did.

The issue is resolved!!

I will list the things I did for future referrence should someone need it.

1) I did as you recommended and removed the wpv short code prefix and registered each short code. They are working perfectly.

2) Instead of focusing on the Cred forms being corrupt - I decide to revisit the redirect code itself.
I could not understand why only the two you identified were problematic and others that I had didn't cause the same problem. So I rewrote the bad ones using the exact format of the working one and this took care of the issue. below is the before and after code for the two redone redirects.
Before:

add_filter('cred_success_redirect', 'return_item_edit_redirect',10,3);
function return_item_edit_redirect($url, $post_id, $form_data)
{
    if ($form_data['id']==50199)   // if return item edit form redirect to vendor-return
    {
        $order_id = get_post_meta($post_id, '_wpcf_belongs_vendor-returns_id', true);  // get order id
        $title = get_the_title($order_id);  // get return title
        $slug = sanitize_title($title);
        $url = '<em><u>hidden link</u></em>'.$slug.'/?cred-edit-form=50197';
        return $url;
    }
}

After:

add_filter('cred_success_redirect_50199', 'redirect_form_50199',10,3);
function redirect_form_50199($url, $post_id, $form_data)
{
    if ($form_data['id']==50199)   // if return item edit form redirect to vendor-return
    {
        $order_id = get_post_meta($post_id, '_wpcf_belongs_vendor-returns_id', true);  // get order id
        $title = get_the_title($order_id);  // get return title
        $slug = sanitize_title($title);
        $url = '<em><u>hidden link</u></em>'.$slug.'/?cred-edit-form=50197';
        return $url;
    }
}

Before:

add_filter('cred_success_redirect', 'item_edit_redirect',10,3);
function item_edit_redirect($url, $post_id, $form_data)
{
    if ($form_data['id']==40866)   // if line item edit form redirect to vendor-order
    {
        $order_id = get_post_meta($post_id, '_wpcf_belongs_vendor-orders_id', true);  // get order id
        $title = get_the_title($order_id);  // get order title
        $slug = sanitize_title($title);
        $url = '<em><u>hidden link</u></em>'.$slug.'/?cred-edit-form=40057';
        return $url;
    }
}

After:

add_filter('cred_success_redirect_40866', 'redirect_form_40866',10,3);
function redirect_form_40866($url, $post_id, $form_data)
{
    if ($form_data['id']==40866)   // if line item edit form redirect to vendor-order
    {
        $order_id = get_post_meta($post_id, '_wpcf_belongs_vendor-orders_id', true);  // get order id
        $title = get_the_title($order_id);  // get order title
        $slug = sanitize_title($title);
        $url = '<em><u>hidden link</u></em>'.$slug.'/?cred-edit-form=40057';
        return $url;
    }
}