Forums

ChronoForms v4 for Joomla! 1.5/1.6 RC1.8 bug fixes

GreyHead 19 Apr, 2011
[list=a]
  • There's a bug with the Joomla! Login action. See the fix in this post.

  • There appears to be a serious bug in Joomla! 1.6.2 that fails to load the core JavaScript files in the Forms Manager view. A workaround is in this post. Fix is to upgrade to 1.6.3

  • There's a bug in the Joomla! Login action. Max posted a fix here

  • There's a bug with the Submit Content action not creating a title alias. Max posted a fix here (I'm not sure if this is for Joomla! 1.5 or 1.6 or both.)

  • The date-time picker has a two-part bug. The first part is in html_helper.php around line 303 that forces the addition of the cf_date_picker class to any date-picker field if the time-picker options aren't selected. This means that the standard date-picker options are always applied even if a unique class is added.

  • The second part is in cfaction_show_html.php around line 203 where the custom setting is shown last - so the standard one is always used if the cf_date_picker class is present.

  • There is an unrelated time-picker bug in this same code block where the use of str_replace("}", . . . breaks any datepicker option that uses } for example in my_picker::{ minDate: {date, '04-04-2011', format: 'm-d-Y' } } both the }s are replaced instead of just the final one.

  • Bizzynate identified a bug and fix in the File Upload action. See this post

  • abeletsky identifed a bug with ChronoForms on the home page. See this post. See the fix from Buro26 here.

  • There is a bug in the interation of the datepicker and validation scripts. The datepicker script moves the original input off screen and the validation error message is also off-screen (it partially appears at the top left corner).

  • Mr CompTech noted some data losses when switching from the Advanced Mode Editor to the Easy Mode. See this post

  • Mr CompTech also noticed that it would be helpful to have the Menu Item event default to 'load'.

  • chrissy6930 noted some Browser specific formatting issues in the Admin area (see later post in this thread).

  • There is a little bug that breaks using 'Added events' with Ajax. Fix is at the end of this post.
  • [/list:o]
    Bob
    GreyHead 26 Apr, 2011
    Hi,

    This post is about fixes for the date-picker bugs in ChronoForms v4RC1.8. These fixes were developed in Joomla! 1.5 and have not yet been tested in Joomla! 1.6 so some small tweaks may still be required.

    The default date-picker works OK but problems arise when you try to customise a date or time picker. Please see points e, f & g in the previous post.

    There are two changes required for this fix. The first is in administrator/components/com_chronoforms/helpers/html_helper.php around line 287. Look for the section starting case 'datetime': and replace the first part as show here:
    			case 'datetime':
    			// start hack
    				if ( $tag['class'] ) {
    					str_replace(array('    ', '   ', '  '), ' ', $tag['class']);
    					$class_array = explode (' ', $tag['class']);
    				} else {
    					$class_array = array();
    				}
    				if ( isset($tag['timeonly']) && (int)$tag['timeonly'] == 1 ) {
    					$class_array[] = 'cf_time_picker';
    				} elseif ( isset($tag['addtime']) && (int)$tag['addtime'] == 1 ) {
    					$class_array[] = 'cf_datetime_picker';
    				} else {
    					$class_array[] = 'cf_date_picker';
    				}
    				$tag['class'] = implode(' ', $class_array);
    			// end hack
    				if(isset($tag['timeonly']))unset($tag['timeonly']);
    				if(isset($tag['addtime']))unset($tag['addtime']);
    				unset($tag['tag']);
    				$tag['type'] = 'text';
    				$output .= '<input';
    				foreach($tag as $k => $v) {
    					$output .= ' '.$k.'="'.$v.'"';
    				}
    				$output .= ' />'."\n";
    				break;

    This fix cleans up the adding of classes to the datepicker.

    The second fix is to the file administrator/components/com_chronoforms/form_actions/show_html/cfaction_show_html.php around line 189. Look for the function _loadDatePickerScripts($form) and replace the whole function with
    	function _loadDatePickerScripts($form)
    	{
    		$document =& JFactory::getDocument();
    		JHTML::_('behavior.mootools');
    		global $mainframe;
    		$CF_PATH = ($mainframe->isSite()) ? JURI::Base() : $mainframe->getSiteURL();
    		$document->addStyleSheet($CF_PATH.'components/com_chronoforms/css/datepicker/datepicker_dashboard.css');
    		$document->addScript($CF_PATH.'components/com_chronoforms/js/datepicker/datepicker.js');
    		$datetime_array = array(
    			"cf_date_picker"     => "{pickerClass: 'datepicker_dashboard', inputOutputFormat: 'Y-m-d H:i:s', allowEmpty: true}", 
    			"cf_datetime_picker" => "{pickerClass: 'datepicker_dashboard', inputOutputFormat: 'Y-m-d H:i:s', timePicker: true, allowEmpty: true}", 
    			"cf_time_picker"     => "{pickerClass: 'datepicker_dashboard', inputOutputFormat: 'Y-m-d H:i:s', timePickerOnly: true, allowEmpty: true}"
    		);
    		//$selector = 'dateTimePicker';
    		$settings = array();
    		$datetime_picker_selectors = $form->form_params->get('datepicker_config', '');
    		if ( !empty($datetime_picker_selectors) ) {
    			$date_selectors = explode("|#|", $datetime_picker_selectors);
    			foreach ( $date_selectors as $date_selector ) {
    				if ( !$date_selector ) {
    					continue;
    				}
    				$config = explode("::", $date_selector);
    				$selector = trim($config[0]);
    				$datePickerSettings = "{pickerClass: 'datepicker_dashboard', inputOutputFormat: 'Y-m-d H:i:s', allowEmpty: true}";
    				
    				if ( trim($config[1]) ) {
    					$config[1] = trim($config[1]);
    					$config[1] = substr($config[1], 0, strrpos($config[1], '}'));
    					$temp = array($config[1]);
    					//add the picker class if not set by the user
    					if ( strpos($config[1], "pickerClass" ) === false){
    						$temp[] = "pickerClass: 'datepicker_dashboard'";
    					}
    					//add the value format if not set by the user
    					if ( strpos($config[1], "inputOutputFormat" ) === false ){
    						$temp[] ="inputOutputFormat: 'Y-m-d H:i:s'";
    					}
    					//add the allowEmpty format if not set by the user
    					if ( strpos($config[1], "allowEmpty" ) === false ){
    						$temp[] ="allowEmpty: true";
    					}
    					$datePickerSettings  = implode(', ', $temp).' }';
    				}
    				$settings[$selector] = $datePickerSettings;
    				unset($config, $temp);
    			}
    		}
    		$settings = array_merge($settings, $datetime_array);
    		$script = "";
    		foreach($settings as $class => $setting) {
    			$script .= "new DatePicker( '.{$class}', {$setting} ); \n"; 
    			$script .= "console.log(startDate); \n";
    		}
    		$script = "//<![CDATA[
    		window.addEvent('load', function() {
    			{$script}
    		});
    		//]]>
    		";
    		$document->addScriptDeclaration($script);
    	}
    

    This fix cleans up the addition of default options to the datepicker; sets any custom datepicker class before the standard classes; and fixes the bug with options containing a }.

    Later . . .

    Please see this post for a fix to the second code chunk above for Joomla! 1.6.

    BUT it looks as though this version of datepicker.js won't run under Mootools 1.3 (used in Joomla! 1.6.3+) There's an forked version linked from the post with the fix - not yet trialled.

    Bob
    smhh 12 May, 2011
    Hello,

    I write from Germany.

    For Fix the Bug for you must insert in ( Joomla 1.6.3 ) :

    administrator/components/com_chronoforms/form_actions/show_html/cfaction_show_html.php

    after :

    $settings[] = $selector.', '.$datePickerSettings;


    insert this :

    if($settings[3] != '')	$settings[1] = '';


    I hope this will help you. On my Site it works fine.




    The Standard Class was not overwrite with the custom Class Settings in Genarl Tab.
    With this Fix the Setting in $array[1] is cleared and the custom is in use.
    GreyHead 12 May, 2011
    Hi smhh,

    Thanks for this - its'a good workaround as long as you only have one datepicker on the page. I think it will fail in the (infrequent) case that one datepicker is using the default settings and another one is using custom settings.

    Bob
    bizzynate 13 May, 2011
    I've discovered a bug with the Upload Files action plugin for v4 RC1.8.

    The symptoms:
    [list]
  • A form is published with a File Upload element and no requirement for this field.

  • The Upload Files action is set in the onSubmit event, with sub events for OnSubmit and OnFail.

  • The form is submitted with no attachment.

  • The submission of the form halts returning no actions from either the OnSubmit or OnFail events.
  • [/list]

    The problem:
    Forms that have a "File Upload" element, when submitted with no file attached, return neither an "OnSuccess" or "OnFail" event. Both variables are set to 0.

    A proposed solution:
    Modifying the /administrator/components/com_chronoforms/form_actions/upload_files/upload_files.php file on line 115, change:

    			$form->data['_PLUGINS_']['upload_files'] = array_merge($form->data['_PLUGINS_']['upload_files'], $form->files);
    		}


    to:

    			$form->data['_PLUGINS_']['upload_files'] = array_merge($form->data['_PLUGINS_']['upload_files'], $form->files);
    			// If no failures occurred, assume there were no attachments and everything was successful
    			if(!$this->events['fail']) $this->events['success'] = 1;
    		}


    The foreach() continues at line 61 when it determines no file was attached. In the event that the foreach() loop ends with no attachments, there is no indication of success. This solution is a catch-all: presuming that if no failures occurred at the end of the function, it's safe to set the success of the event to true.
    chrissy6930 28 May, 2011
    Hi there,

    I think there are a couple browser dependant flaws on the admin side
    (checked in IE7/IE8, FF3/FF4, Opera 11, Safari 5, Chrome 11)

    in IE7/IE8 (XP/Vista):
    in the form wizard - preview tab the elements are displayed messed up (khepri template)
    to fix that in formwizard.css find:
    .wizard_element { position: relative; padding: 11px 5px 7px; background-color: #fbfbfb; border: 1px solid #dddddd; margin:0 10px 10px 10px;}
    and adjust for:
    .wizard_element { position: relative; padding: 11px 5px 7px; background-color: #fbfbfb; border: 1px solid #dddddd; margin:0 10px 10px 10px; clear:both;}
    also find:
    .droppable label { float: left; width: 110px; padding-left: 6px;}
    and adjust for:
    .droppable label { width: 110px; padding-left: 6px;}

    in form wizard - preview / events tab when clicking the edit icon the popup would be flushed right and to the bottom of the browser window with scrolling being impossible and the close button not visible as the right part of the popup not being visible.

    in form wizard - elements tab all elements are listed in a single column messing up the layout

    in form wizard - actions tab all elements no matter what slide they belong to are listed with the slides hiding behind the list and messing up the template


    in Opera 11:
    in preview tab when clicking the edit icon any available checkboxes such as the one behind Enable Time picker would not be visible. if I know where to look for it I can select it though


    J!1.5.23, CF 4 RC1.8
    chrissy6930 30 May, 2011
    css issue in form manager

    if the list of components under components menu item is longer than / reaches below the bottom of the active slide draggable items would overlay the component list.
    to fix that a z-index smaller than 100 would need to be appliedto the respective class

    find in ../administrator/components/com_chronoforms/css/formwizard.css:
    .elements_list .dragable {width: auto; cursor: move; border: 1px solid #eeeeee; margin: 9px 0; padding: 7px 5px; background: url(formwizard/drag.png) no-repeat right center; background-color:white; font-weight: bold; }


    and adjust for:
    .elements_list .dragable {
    	width: auto; cursor: move; border: 1px solid #eeeeee; margin: 9px 0; padding: 7px 5px;
    	background: url(formwizard/drag.png) no-repeat right center; background-color: white; font-weight: bold;
    	z-index: 50;
    }
    This topic is locked and no more replies can be posted.