ChronoForms v4 RC 1.4 bug-fixes

GreyHead 25 Feb, 2011
As far as I can see Max has fixed all of these in CFv4 RC1.5 so this post is now closed.

ChronoForms v4 RC 1.4 had a few major bugs and a large number of small bugs that will probably cause no problems unless your site has Error Reporting set to Maximum when you sometimes get error messages in incovenient places: for example the CSS code box has the following contents:

<br />
<b>Notice</b>: Undefined index: content1 in <b>R:\xampp\htdocs\joomla1.5k\administrator\components\com_chronoforms\form_actions\load_css\load_css.ctp</b> on line <b>5</b><br />



I've listed some fixes below that can be tidied up in a future release.

Bob

Major bugs
[list=1]
  • Email file attachment bug: At around line 150 of form_actions/email/email.php is this block of code
    foreach($attachments as $attachment){
      if(isset($form->files[$attachment])){
        $email_attachments[] = $form->files[$attachment]['path'].$form->files[$attachment]['name'];
      }
    }

    this section .$form->files[$attachment]['name'] is missing from the end of the third line.

  • Repeated actions are not handled correctly. Only the last is used (found in relation to the Multi-language event).
    Fix requires two changes. In com_chronoforms/libraries/chronoform.php find the function _processAction() around line 128 and replace
    $this->main_event_actions[$action] = $action_details;
    with
    $this->main_event_actions[] = $action_details;
    and in com_chronoforms/chronoforms.html.php around line 23 replace
    				foreach($form->main_event_actions as $action => $actiondata){
      $viewFile = JPATH_SITE.DS."administrator".DS."components".DS."com_chronoforms".DS.'form_actions'.DS.$action.DS.'cfaction_'.$action.'.ctp';
    with
    foreach($form->main_event_actions as $action => $actiondata){
      $viewFile = JPATH_SITE.DS."administrator".DS."components".DS."com_chronoforms".DS.'form_actions'.DS.$actiondata->type.DS.'cfaction_'.$actiondata->type.'.ctp';
    and, in the same file, around line 28 replace
    require_once($viewFile);
    with
    require($viewFile);


  • The <form . . .> tag is output twice.
    Fix is to comment out line 84 of cfaction_show_html.php
    $this->_showErrors($form);
    // echo $output;
    ob_start();


  • The 'Copy form' icon in the toolbar copies the form elements but not the Actions that have been assigned. There is a fix in this post.
  • [/list:o]

    Minor bugs

    [list=a]
  • The CSS code error above requires line 15 of form_actions\load_css\load_css.php to be
    $action_params = array('content1' => '');
    This fixes[quote]Notice: Undefined index: content1 in administrator\components\com_chronoforms\form_actions\load_css\load_css.ctp on line 5[/code]

  • [*]The same change is required in form_actions\load_js\load_js.php to fix [quote]Notice: Undefined index: content1 in /mysite/htdocs/administrator/components/com_chronoforms/form_actions/load_js/load_js.ctp on line 5[/quote]
    [/*]
    [*](from another thread) around line 23 of html_helper.php an extra line is needed to removed a PHP Notice:[code] $tag['type'] = $fieldoptions['type'];
    $tag['name'] = $fieldname;
    $tag['checked'] = ''; // bugfix[/code]
    [/*]
    [*](from another thread) to enable validation on a datepicker add this at line 612 of admin.chronoforms.php[code]input case 'datetime':[/code]NB the validation still will not work correctly because the message is hidden.
    [/*]
    [*]There is a small bug around ine 26 of administrator/components/com_chronforms/form_actions/upload_files/upload_files.php where $MyForm->xxx appears in place of $form->form_details (I forget exactly what the xxx part was). This prevents ChronoForms from creating the uploads folder if it doesn't already exist.
    [/*]
    [*]File name substitution in Email & Thank you page bug: the fix is in form_actions/upload_files/upload_files.php around line 90 where one extra line is required.[code]if($uploaded_file){
    $form->files[$file_data[0]] = array('name' => $file_name, 'path' => $upload_path, 'size' => $file_post["size"]);
    $form->data[$file_data[0]] = $file_name; // <-- add this line
    $form->debug[] = $upload_path.$file_name.' has been uploaded OK.';
    $this->events['success'] = 1;
    }else{[/code]
    Once this line is added the file name substitution works in the Email and Thank you page code.
    [/*]
    [*] PHP Note visible in the Wizard:
    [quote]Notice: Undefined variable: field_value in R:\xampp\htdocs\joomla1.5k\administrator\components\com_chronoforms\helpers\html_helper.php on line 145[/quote]
    Fix is to insert a line at line 125 of this file[code]}
    $field_value = ''; // <-- insert this line
    if(isset($fieldoptions['default']) . . .[/code]
    [/*]
    [*]PHP Notice on the Wizard Events tab[quote]Notice: Undefined offset: 1 in R:\xampp\htdocs\joomla1.5k\administrator\components\com_chronoforms\views\form_wizard.php on line 418[/quote]
    Fix is to add an if clause in this file around line 417[code]foreach($params as $param){
    $temp = explode("=", $param, 2);
    if ( isset($temp[1]) ) { // <-- add this line
    $action_data->params[$temp[0]] = $temp[1];
    } // <-- and this line
    }[/code]
    [/*]
    [*]PHP Notice in the front-end[quote]
    Notice: Undefined variable: value in R:\xampp\htdocs\joomla1.5k\components\com_chronoforms\libraries\includes\data_republish.php on line 193[/quote]Fix is to insert one line at line 181[code]$field_name = str_replace('[]', '', $field_name);
    $value = ""; // <-- insert this line
    if(!isset($data[$field_name])){[/code]
    [/*]
    [*]PHP Notice in a Custom Element id field[quote]<br /> <b>Notice</b>: Undefined index: input_id in <b>R:\xampp\htdocs\joomla1.5k\administrator\components\com_chronoforms\form_elements\input_custom.ctp</b> on line <b>7</b><br />[/quote]
    Fix is to add this to the array in the file:[code]'input_id' => '',[/code] or perhaps better[code]'input_id' => 'input_custom_{n}',[/code]
    [/*]
    [*]PHP Notice before a Custom Element Pure Code Checkbox[quote]Notice: Undefined index: checked in R:\xampp\htdocs\joomla1.5k\administrator\components\com_chronoforms\helpers\html_helper.php on line 246[/quote]
    Fix is to add isset check to line 246[code]if( isset($tag['checked']) && (bool)$tag['checked'] === true){[/code]
    [/*]
    [*]PHP Notice in the Drop box of a new form before any Events are saved[quote]Notice: Undefined variable: eventscode in R:\xampp\htdocs\joomla1.5k\administrator\components\com_chronoforms\views\form_wizard.php on line 304[/quote]
    Fix is to define $eventscode near line 271[code]$max_action_index = -1;
    $eventscode = array(); // <- add this line[/code]
    [/*]
  • PHP Notice in the Form Settings box

    Notice: Undefined index: label in R:\xampp\htdocs\joomla1.5k\administrator\components\com_chronoforms\helpers\html_helper.php on line 110

    [/quote]
    Fix is to add the label item to this array around line 326 of form_wizard.php
    <?php echo $HtmlHelper->input('form_type', array('type' => 'hidden', 'label' => '', 'value' => (!empty($form)) ? $form->form_type : 1)); ?>
  • [/list:o]
    This topic is locked and no more replies can be posted.