• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

[solved]SyntaxError: Unexpected token < in JSON at position 0

merlino68

Member
when I change the data of a list with the relative form, I receive the error in question.
The form opens in Ajax popup.
No problem if i disable Ajax for link
I try to update from github but it does not solve the problem
Joomla 3.9.3
Fabrik 3.9
php 7

Thanks
 
Check the response in the network tab of your browser console.
This is usually a notice/warning/error breaking the expected JSON response.
 
this is the error report
Uncaught TypeError: Cannot read property 'findClassUp' of null
at eval (eval at runLoadEvent (media/com_fabrik/js/element.js:206), <anonymous>:1:53)
at Object.runLoadEvent (media/com_fabrik/js/element.js:206)
at Object.e.extend.$owner (mootools-core.js:38)
at Object.addNewEvent (media/com_fabrik/js/element.js:254)
at Object.e.extend.$owner (mootools-core.js:38)
at Object.dispatchEvent (media/com_fabrik/js/form.js:966)
at Object.e.extend.$owner (mootools-core.js:38)
at eval (eval at <anonymous> (jquery.min.js:2), <anonymous>:101:14)
at Object.execCb (eval at <anonymous> (jquery.min.js:2), <anonymous>:29:311)
at $.check (eval at <anonymous> (jquery.min.js:2), <anonymous>:18:423)
 
Do you have a JS event on one of your elements, running on 'load'?

If so, and it includes the use of the findClassUp() method, you need to debug it, and figure out why the selector you are doing a findClassUp() on is null.

Also, if you are using findClassUp(), best to replace it with something like jQuery's closest(), like ...

Code:
var mything = jQuery('.mySelector').closest('someOtherSelector');

-- hugh
 
I dont have a JS on load , i have this in calc element:

$db =& JFactory::getDBO();
$query = "SELECT COUNT(DISTINCT`Sezione`) from tm_schede where id_allen={tm_allenamenti___id}";
$db->setQuery($query);
return $db->loadResult();
 
Are you sure?

The error being thrown is definitely in our runLoadEvents() method, where it evaluates Javascript code for element JS events set to run on 'load'.

Can you check all the elements on the form in the popup, have a look at the Javascript section for each element, make sure none of them have a 'load' event set up.

-- hugh
 
There is only one element with JS but even if unpublished the form it makes the same error
I think the problem is in the calc element.
When the element is unpublished, the form works.
When the element is published, I have the error when I save.
I solved by changing the calc element in the field element and doing the calculation in another list.

-- hugh
 
OK.

BTW, the issue with your query in that calc is probably twofold:

First, you always need to quote placeholder values, so the query doesn't error out if the element is empty, and second you probably need to use the _raw (if it's a join element).

Code:
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('COUNT(DISTINCT `Sezione`) as tot')->from('tm_schede')->where('id_allen=' . $db->quote('{tm_allenamenti___id}'));
$db->setQuery($query);
return $db->loadResult();
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top