CGBetterForms problems

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Simon66
Power Poster
Power Poster
Posts: 250
Joined: Wed Aug 29, 2007 4:36 am
Location: Sydney Australia

CGBetterForms problems

Post by Simon66 »

I'm having a few problems with CGBetterForms. I'm using the latest version 1.9.5. CMSms 2.2.10 & PHP 7.3

I can't save form results to a flat file. Everything in the templates gets replaced with HTML entities. Which causes an error message on the front end.

data-cgbf-extension - this data attribute gives me an error for every file format whether it's listed or not.

data-cgbf-accept - this data attribute gives me an error for every mime type except images.

Is it my hosting that's the problem?
Has anyone else got these working?

Cheers
Simon66
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: CGBetterForms problems

Post by calguy1000 »

data-cgbf-accept and data-cgbf-extensions are attributes applicable to inputs of type file are used to validate on the server side, the type of files that are uploaded.

data-cgbf-accept should be a comma separated list of mime type specifications (wildcards allowed). i.e: data-cgbf-accept="application/pdf, image/*"
if you don't know the mime type of a specific type of file you may have to look it up.

Hint: in some circumstances different computers (windows, mac, linux) can identify the same file with different mime types (it's all depending on which standard they listen to for that version of the OS). You need to know how your server identifies the file. Images are fairly standard in my experience, but CSV files from excel are not. and even PDF may not be.

data-cgbf-extensions should be a comma separated list of file extensions, i.e: data-cgbf-extensions="jpg jpeg png webp svg pdf"
it is not recommended to use file extensions as they are not even a reasonably reliable method of determining the type of a file.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Simon66
Power Poster
Power Poster
Posts: 250
Joined: Wed Aug 29, 2007 4:36 am
Location: Sydney Australia

Re: CGBetterForms problems

Post by Simon66 »

Thanks CalGuy
I figured out the problem.
I had the {CGBetterForms form="Contact Form"} in the template instead of the content. So I switched 'Display form inline' to yes and 'Upload files asynchronously' to yes.

With data attributes I had copied the example from the module help:

Code: Select all

data-cgbf-accept="image/*,application/*pdf"
After finding a bunch of mime types online I noticed the * before pdf. So I removed it and added more mime types.
This made it work properly.

Mime types:

Code: Select all

application/pdf,
application/msword, (.doc)
application/vnd.openxmlformats-officedocument.wordprocessingml.document, (.docx)
application/vnd.oasis.opendocument.text (.odt)
I still can't save to Flat File though.
The document in the root is 'form_submissions.csv'
I don't change the template but I get an error on the front end.
Then I open the settings for 'save to Flat File' and the template looks like this:

Code: Select all

{strip}
"{$myname|default:''}"
,"{$myemail|default:''}"
,"{$myphone|default:''}"
,"{$inputfile|default:''}"
,"{$message|default:''}"
{$EOL}{/strip}
Anyway, the form is working great without this.

Cheers
Simon66
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1627
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: CGBetterForms problems

Post by DIGI3 »

Looks to be the same/similar as a know bug: http://dev.cmsmadesimple.org/bug/view/11855
Not getting the answer you need? CMSMS support options
Post Reply

Return to “Modules/Add-Ons”