Form Builder


[#12189] Fatal error on Add New Field

Created By: Tristan (tristan)
Date Submitted: Thu Nov 14 05:51:59 -0500 2019

Assigned To: Fernando Morgado (JoMorg)
Version: 1.0.2
CMSMS Version: 2.2.12
Severity: Major
Resolution: Fixed
State: Open
Fatal error on Add New Field
Detailed Description:
Getting a fatal error when trying to add a new field, either via the "Add New
Field" or with the Fast field adder.

Got error 'PHP message: PHP Fatal error:  Uncaught CmsError404Exception: Module
action not found in
CMSModule->DoAction('admin_add_edit_...', 'm1_', Array, '')\n#1
FormBuilder->DoAction('admin_add_edit_...', 'm1_', Array, '')\n#2
CMSModule->DoActionBase('admin_add_edit_...', 'm1_', Array, '',
Object(Smarty_CMS))\n#3 {main}\n  thrown in
/home/user/domains/ on
line 1395\n', referer:


Date: 2019-11-14 05:53
Posted By: Tristan (tristan)

Same error when trying to edit of course.
Date: 2019-11-14 09:37
Posted By: Tristan (tristan)

For some reason the action.admin_add_edit_field.php file isn't there after
install of the xml on some hosts, using the tar.gz will fix this problem.
Date: 2020-03-28 19:46
Posted By: Ruud van der Velden (ruudvdvelden)

This seems to be caused by Module Manager (core). 
lib\classes\ starting at line 402 (CASE 'FILE':)

Note there's an if( !file_exists( $moduledir ) ) 
if that's true (and for the first file in the downloaded xml that is true
because the folder /modules/FormBuilder is not yet created on NEW installs) it
will create the modules/FormBuilder folder but it will NOT create the file.

My suggestion is to remove 'else;  from line 421:

                        // ready to go
                        if( !file_exists( $moduledir ) ) {
if( !@mkdir( $moduledir ) && !is_dir( $moduledir ) )
throw new
CmsFileSystemException(lang('errorcantcreatefile').': '.$moduledir);
line 421 -->  if( $moduledetails['isdir'] ) {
if( !@mkdir( $filename ) && !is_dir( $filename ) ) {
throw new
CmsFileSystemException(lang('errorcantcreatefile').': '.$filename);
                        else {
                            $data = $moduledetails['filedata'];
if( strlen( $data ) ) $data = base64_decode( $data
                            $fp = @fopen( $filename, "w" );
if( !$fp ) throw new
CmsFileSystemException(lang('errorcantcreatefile').' '.$filename);
                            if( strlen( $data ) ) @fwrite( $fp, $data );
                            @fclose( $fp );

Another workaround could be to add some bogus file/dir at the top of the FILE
list in the xml for FormBuilder. The file/dir itself will not be created but the
module/FormBuilder folder will.
Date: 2020-03-28 19:53
Posted By: Ruud van der Velden (ruudvdvelden)

I noted that other mofule's xml files have:


As the first module\file element. That will work too and will be less intrusive
than the core change.
Date: 2020-06-09 16:29
Posted By: Fernando Morgado (JoMorg)

The generated XML file had an issue not the module itself. XML file fixed and
uploaded. All should be good now. Thank you.

Updated: 2020-06-09 16:29
resolution_id: 5 => 7
assigned_to_id: 100 => 12532

Updated: 2019-11-14 05:53
resolution_id: => 5