How can i integrate validation?

redhat99 27 Apr, 2011
I maid a form and i set some field on required.
In the DOM there is a class " validate['required','alpha']".

But if I dont set something in that field, I click submit, and nothing happened?!
What do I have to do? Can you explain it to me?

thanks a lot.
GreyHead 27 Apr, 2011
Hi redhat99,

Please post a link to the form so we can take a quick look.

GreyHead 27 Apr, 2011
Hi redhat99,

Your template (or some other component) is loading the jQuery JavaScript library. Out of the box jQuery isn't compatible with the MooTools library used by Joomla! and ChronoForms. You can use jQuery with MooTools in no-conflict mode. There are various ways of doing this. The simplest is to add a line of script in the ChronoForms Form JavaScript box:
This will free the $ operator which is used by MooTools, so you may need to update your own javascripts to use the longer jQuery operator.

There is also a neat Joomla! system plugin named SC jQuery that allows you to control on which pages jQuery is loaded, and will always load it in no-conflict mode.

redhat99 27 Apr, 2011
thank you very much Bob. This was my Problem.😀
redhat99 27 Apr, 2011
where can i change the german languagetext of the errors?
GreyHead 05 May, 2011
Hi redhat99,

You can change the language of the errors in the Form JS Validation tab (you can get there by clicking Forms Manager, then the form name.

You can edit the the default language files in components/com_chronoforms/js/formcheck/lag/de.js but note that changes here may be overwritten if you upgrae ChronoForms.

You can also set messages through the values of the input title attribute, but this will show the same message for all validation errors on that input.

Or, if you use the custom Show HTML [GH] action, you can configure custom messages for all of the validations.

tsili 19 May, 2011
Hi GreyHead,

Is there a way to change the language of the errors depending on the joomfish language? I have translated all fields/thank you messages etc. using the Multi-Language option but I can't find a way to translate those messages...
GreyHead 19 May, 2011
Hi tsili,

With ChronoForms v3 you can use the Title attributes of the inputs to set custom messages and then the multi-language plug-in to translate them.

I think that ChronoForms v4 has a range of languages built in.

tsili 20 May, 2011
Hi GreyHead and thanx for answering.

Sorry, my bad, I didn't specify the version I am using: it's V4
Yes, you are right that it has a range of languages built in, but how do you specify in the Forms Manager->JS Validation->JS Validation Language to use the corresponding one when you translate a form? This is not something done by the component automatically based on the i.e. Joomfish Language.
To be honest, to overcome the problem, I created two separate forms one for English-one for Greek. So I managed to solve my problem using a workaround.
But I am sure that this is something that will be needed by other people in the same situation who would like to use the Multi-language option of V4 instead of creating separate forms for each language.

GreyHead 20 May, 2011
Hi tsili,

Here's a workaround - but it involves hacking the code in administrator/components/com_chronoforms/form_actions/cfaction_show_html.php

Find this line around line 173
$document->addScript($CF_PATH.'components/com_chronoforms/js/formcheck/lang/'.$form->form_params->get('jsvalidation_lang', 'en').'.js');
and replace it with this code:
		$short_tag = $form->form_params->get('jsvalidation_lang', '');
		if ( !$short_tag ) {
			$lang =& JFactory::getLanguage();
			$tag = $lang->getTag();
			$dtag = $lang->getDefault();
			if ( !$tag ) {
				$tag = $dtag;
			$short_tag = strstr($tag, '-', true);
		$lang_path = JPATH_SITE.DS.'components'.DS.'com_chronoforms'.DS.'js'.DS.'formcheck'.DS.'lang'.DS;
		if ( !JFile::exists($lang_path.$short_tag.'.js') ) {
			$short_tag = 'en';
		$script = $CF_PATH.'components/com_chronoforms/js/formcheck/lang/'.$short_tag.'.js';
		//$document->addScript($CF_PATH.'components/com_chronoforms/js/formcheck/lang/'.$form->form_params->get('jsvalidation_lang', 'en').'.js');

This looks first to see if a language is configured in the form General tab;
if not then it looks for the currently set user language;
if that isn't set it uses the site default language.

It will load that language file if it exists; or, if it doesn't exist, the English language file.

I'll go and add this to my customised Show HTML [GH] action shortly.


Later: the updated Show HTML [GH] action is available here
tsili 20 May, 2011
Nice solution Bob!
I believe that this code should be included in any future version/release.

Take care!
This topic is locked and no more replies can be posted.