Uncaught SyntaxError: Unexpected token : (solved)

zebrafilm

Member
Just update to the latest Github from my 3.1 version and run into an issue.
In the console I get: Uncaught SyntaxError: Unexpected token :
Found out that if I switch off the calc plugin the problems goes away.
This happens even with an empty calc element on a new form / group.

What could be wrong?
 
This is usually an error message/warning in your network response where Fabrik is expecting a json string.
Check with a browser dev tool to see the original message creating this "Syntax Error".
 
Just to expand on that one, use either FireBug or Chrome's developer tools, look in the "net" tab or console when the page loads, and you should see where an AJAX call firess of to the server for your calc. Open that up, and look for the Response data.

-- ugh
 
Thanks guys. Already been watching this but of course the whole issue suddenly is gone after I did a 'database update' in the form. Hope it stays like this.
 
Interesting. All a "database update" really does i smakes sure that all the elements you have defined in a form actually exist as columns in the underlying table, and if not, it creates them.

Did you trash an element which you are using in a calc?

The most common way a column gets removed accidentally is if you have trashed a copy of an element, then emptied the trash, and said "yes" to dropping the column. One of these days, I'll add some code which checks to see if that column is still being used by any other elements, and if so ask "are you really REALLY sure you want to drop the column from the table?".

-- hugh
 
Sounds possible but if that is the case, it should throw in an error pointing to the issue, not suddenly 'disappear'.
If you make that check, it is also nice to name where the column is used, not just REALLY???? :)
 
Well, we ask if you want to drop the column from the database. If you say "yes", when you are still using it, it's pilot error. We can only go so far in protecting people from themselves. And the error you would have seen from the calc would have told you what column was missing.

But as I said, "one of these days", when I have some time ... the main problem is, it's major pain the in ass adding that kind of stuff in to J!'s back end UI.

-- hugh
 
I have a similar problem. In the browser console I get multiple errors: Uncaught SyntaxError: Unexpected token <

Looking at the details, I get:
(<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>...\libraries\joomla\database\driver.php</b> on line <b>1490</b><br />
<br />
<b>Fatal error</b>: Call to a member function encryptFieldName() on a non-object in <b>...\components\com_fabrik\models\list.php</b> on line <b>9756</b><br />

This only happens if I show a column in the list view of the type databasejoin and/or cascadingdropdown. Turning off the filter on the databasejoin column (element) solves the problem.
 
Line 9756 is about 30 lines out from the current code, so you probably haven't updated in a while. Try the latest github, may well have fixed whatever the problem was. Or we should have 3.3 out today tomorrow, you could update to that and see if it fixes it.

I just tested, and joins and CDD's as filters work fine for me.

-- hugh
 
Im getting the same error in a form using autofill plugin.

SyntaxError: Unexpected token <

I can see script in console pull all the correct values I need but none are applied to their assigned fields and/or display in the form after clicking the trigger button.

Joomla 3.4, Fabrik 3.3.1
 
I've updated Fabrik to the lastet version from GIT, but I still get this error every second: "Uncaught SyntaxError: Unexpected token <"
This happens when I activate the filter (dropdown) on a databasejoin element (named 'pcata') and a cascadingdropdown element (named 'pcatb') that is watching this first databasejoin element ('pcata').

Console log:
(<br />
<b>Warning</b>: Header may not contain more than a single header, new line detected in <b>..\wwwroot\libraries\joomla\application\web.php</b> on line <b>966</b><br />
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Error: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &#039;AND 1 = -1&#039; at line 4 SQL=SELECT DISTINCT(`pcatb`.`id`) AS value, `pcatb`.`category`AS text
FROM `pcatb` AS `pcatb`
WHERE 4 = -4 AND 1 ORDER BY category ASC
AND 1 = -1</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href='//fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
<style type="text/css">
h1,h2,h3,h4,h5,h6,.site-title{
font-family: 'Open Sans', sans-serif;
}
</style>
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top