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
CGBetterForms problems
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: CGBetterForms problems
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.
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.
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.
Re: CGBetterForms problems
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:
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:
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:
Anyway, the form is working great without this.
Cheers
Simon66
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"
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)
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}
Cheers
Simon66
Re: CGBetterForms problems
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