Forums

JS validation messages

flashfs 23 May, 2016
I just want to use the default JS validation messages, so I don't want to populate the "Title" field of all my inputs.
I saw the language files under the folder /libraries/cegcore/assets/gplugins/gvalidation/lang/. I've tried to add a new file, called br.js (a brazilian portuguese translation), but how can I tell Chornoforms to use it? My Validation tab is set to 'Dynamic language detection'.
I can see it is using the strings from pt.js file, but it is portuguese from Portugal, and it's slightly different from Brazil.
GreyHead 23 May, 2016
Hi flashfs,

I just looked at the code and ChronoForms only looks at the first two characters of the site language code e.g. for pt-BR and pt-PT it only uses the 'pt' part :-(

I suggest that you edit the pt file to do what you need - but please keep a backup copy as it will be overwritten if you upgrade ChronoForms in the future.

Bob
flashfs 23 May, 2016
Thanks for your time, GreyHead.

I saw the existence of a value in the $form object. Isn't it being used? The path is $form->form["Form"]["params"]["js_validation_language"]. Trying setting it to something else, but no change.
GreyHead 27 May, 2016
Hi flashfs,

That setting is used - but as you can see from the code here
		if($form->params->get('js_validation_language', '') == ''){
			$lang = strtolower(\GCore\Libs\Base::getConfig('site_language'));
			$js_lang_tag = explode('-', $lang);
			$form->params->set('js_validation_language', $js_lang_tag[0]);
		}
		
It only uses the first two characters before the -

Bob
This topic is locked and no more replies can be posted.