ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

JS Validation: only onsubmit?

mat 16 May, 2011
In ChronoForms v3 I have the option to give a validation message onBlur, so if somebody leaves some field empty, changing the field focus, he get an instant advice.
[attachment=0]onBlur.png[/attachment]

In ChronoForms v4 I get the JS Validation messages only “on submit".
I missed something (or broken it)?
mat 16 May, 2011
I’ve just added at line 179 of administrator/components/com_chronoforms/form_actions/show_html/cfaction_show_html.php file the options
				display : {
					errorsLocation : 1,
					indicateErrors : 2,
					keepFocusOnError : 0,
					closeTipsButton : 0,
					showErrors : 1
				}
so the function becomes:
    function _loadValidationScripts($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/formcheck/theme/'.$form->form_params->get('jsvalidation_theme', 'classic').'/formcheck.css');
		$document->addScript($CF_PATH.'components/com_chronoforms/js/formcheck/formcheck-yui.js');
		$document->addScript($CF_PATH.'components/com_chronoforms/js/formcheck/formcheck-max.js');
		$document->addScript($CF_PATH.'components/com_chronoforms/js/formcheck/lang/'.$form->form_params->get('jsvalidation_lang', 'en').'.js');
		ob_start();
		?>
		//<![CDATA[
			window.addEvent('domready', function() {
				<?php if($form->form_params->get('jsvalidation_errors', 1)): ?>
				formCheck = new FormCheckMax('<?php echo 'chronoform_'.$form->form_name; ?>', {
				<?php else: ?>
				formCheck = new FormCheck('<?php echo 'chronoform_'.$form->form_name; ?>', {
				<?php endif; ?>
				display : {
					errorsLocation : 1,
					indicateErrors : 2,
					keepFocusOnError : 0,
					closeTipsButton : 0,
					showErrors : 1
				}	
				});										
			});
		//]]>
		<?php
		$script = ob_get_clean();
		$document->addScriptDeclaration($script);
    }
but I hope I’ve missed a configuration panel in the GUI.
GreyHead 18 May, 2011
Hi mat,

I don't think that the official actions allow you to configure the Validation code like this. But I have developed an unofficial version that has a configuration box. Please see this post

Bob
mat 20 May, 2011
I have developed an unofficial version that has a configuration box.

Surely a cleaner approach than hacking the code. Thanks!
This topic is locked and no more replies can be posted.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com