upgrading to new CF gave me some problems

Resolve JavaScript errors and 404 issues after upgrading ChronoForms.

Overview

The upgrade introduced a jQuery syntax error in the backend and caused custom asset scripts to return 404 errors in the frontend due to outdated PHP references and missing files.
Update the PHP code to remove deprecated reference operators and correct string concatenation for script paths, then ensure the custom JavaScript files are present in the correct asset directory.

Answered
md mdma 28 Apr, 2016
Hello everyone,


new Joomla
PHP: 5.4.45-nmm1

after installing new CF:

1.)Js-error-Problem in backend when going into a form config(ajax-loader):
jquery.min.js:2 Uncaught Error: Syntax error, unrecognized expression: #enable-{N}

the jquery.min is located in domain.com/media/jui/js/jquery.min.js

2.)Problems in FE
there´s an 404 error with my custom assets-scripts loading.
At the time i cant go deeper into this because of 1.)

Strange thing i found nothing in the forums here about that...

Greetings
md mdma 28 Apr, 2016
i upgraded chronofomorms through installing the new version-files with joomla-extensions-installer->file upload
md mdma 28 Apr, 2016
temlate isis
jquery.min.js:2 Uncaught Error: Syntax error, unrecognized expression: #enable-{N}
ga.error @ jquery.min.js:2
ga.tokenize @ jquery.min.js:2
ga.select @ jquery.min.js:2
ga @ jquery.min.js:2
m.fn.extend.find @ jquery.min.js:2
m.fn.init @ jquery.min.js:2
e.fn.init @ jquery-migrate.min.js:2
m @ jquery.min.js:2
(anonymous function) @ bootstrap.min.js:8
(anonymous function) @ jquery.min.js:2
m.extend.map @ jquery.min.js:2
m.fn.m.map @ jquery.min.js:2
t.refresh @ bootstrap.min.js:8
t @ bootstrap.min.js:8
(anonymous function) @ bootstrap.min.js:8
m.extend.each @ jquery.min.js:2
m.fn.m.each @ jquery.min.js:2
e.fn.scrollspy @ bootstrap.min.js:8
processScrollInit @ template.js?5c2d67c…:82
(anonymous function) @ template.js?5c2d67c…:65
j @ jquery.min.js:2
k.fireWith @ jquery.min.js:2
m.extend.ready @ jquery.min.js:2
J @ jquery.min.js:2
md mdma 28 Apr, 2016
admin is ok now.

frontend:the 404-problem is with this custom-script and new cf version:

<?php
$lang =& JFactory::getLanguage();
$tag =& $lang->getTag();
$scripturl = "libraries/cegcore/assets/dp_bs3/js/locales/bootstrap-datepicker.$tag.min.js";
$scripturl2= JURI::root().'libraries/cegcore/assets/dp_bs3/';
$scripturl3 = "libraries/cegcore/assets/dp_bs3/js/dp.$tag.js";

$jdoc =& JFactory::getDocument();

$jdoc->addStyleSheet($scripturl2.'css/bootstrap-datepicker3.min.css');
$jdoc->addScript($scripturl2.'js/bootstrap-datepicker.min.js');
$jdoc->addScript(JURI::root().$scripturl);
$jdoc->addScript(JURI::root().$scripturl3);

?>
Gr GreyHead 28 Apr, 2016
1 Likes
Hi mdma,

In recent versions of PHP the use of =& causes problems, please change those lines to
$lang = \JFactory::getLanguage();
$tag = $lang->getTag();

$jdoc = \JFactory::getDocument();
The \ may not be strictly necessary but it does no harm and in some cases gets round problems with namespaces.

Also I suspect the syntax in lines like this may not work
$scripturl3 = "libraries/cegcore/assets/dp_bs3/js/dp.$tag.js";
Please try using this
$scripturl3 = "libraries/cegcore/assets/dp_bs3/js/dp".$tag.".js";
or, better
$scripturl3 = "libraries/cegcore/assets/dp_bs3/js/dp{$tag}.js";
Note the extra . before js at the end in each case.

Bob
md mdma 28 Apr, 2016
<?php
$lang = \JFactory::getLanguage();
$tag = \$lang->getTag();
$scripturl = "libraries/cegcore/assets/dp_bs3/js/locales/bootstrap-datepicker{$tag}.min.js";
$scripturl2= JURI::root().'libraries/cegcore/assets/dp_bs3/';
$scripturl3 = "libraries/cegcore/assets/dp_bs3/js/dp{$tag}.js";

$jdoc = \JFactory::getDocument();

$jdoc->addStyleSheet($scripturl2.'css/bootstrap-datepicker3.min.css');
$jdoc->addScript($scripturl2.'js/bootstrap-datepicker.min.js');
$jdoc->addScript(JURI::root().$scripturl);
$jdoc->addScript(JURI::root().$scripturl3);

?>



i think i didnt get it
md mdma 28 Apr, 2016
Answer
oh sorry i see the custum assets are gone from the folders....
md mdma 28 Apr, 2016
got it working now.

copied the js files again into libraries/cegcore/assets/
when there is something again when updating php version i know where to look up again...
<?php
$lang = \JFactory::getLanguage();
$tag = $lang->getTag();
$scripturl = "libraries/cegcore/assets/dp_bs3/js/locales/bootstrap-datepicker.{$tag}.min.js";
$scripturl2= JURI::root().'libraries/cegcore/assets/dp_bs3/';
$scripturl3 = "libraries/cegcore/assets/dp_bs3/js/dp.{$tag}.js";

$jdoc = \JFactory::getDocument();

$jdoc->addStyleSheet($scripturl2.'css/bootstrap-datepicker3.min.css');
$jdoc->addScript($scripturl2.'js/bootstrap-datepicker.min.js');
$jdoc->addScript(JURI::root().$scripturl);
$jdoc->addScript(JURI::root().$scripturl3);

?>


Thank you alot Bob for helping!!
This topic is locked and no more replies can be posted.