Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

Javascript error when adding a new record

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Paul
Posts: 60
Joined: Mon Aug 25, 2025 6:03 am
Has thanked: 13 times
Been thanked: 2 times

Re: Javascript error when adding a new record

Unread post by Paul »

No, just tried creating a record. How strange.
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4516
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 515 times
Contact:

Re: Javascript error when adding a new record

Unread post by kev1n »

Try using the latest nuform.js from Github. (Download it, replace your local one and log in again into nuBuilder)
Paul
Posts: 60
Joined: Mon Aug 25, 2025 6:03 am
Has thanked: 13 times
Been thanked: 2 times

Re: Javascript error when adding a new record

Unread post by Paul »

Same problem.
Paul
Posts: 60
Joined: Mon Aug 25, 2025 6:03 am
Has thanked: 13 times
Been thanked: 2 times

Re: Javascript error when adding a new record

Unread post by Paul »

Wait, I missed that the error is now different:

Uncaught Error: Syntax error, unrecognized expression: #
Paul
Posts: 60
Joined: Mon Aug 25, 2025 6:03 am
Has thanked: 13 times
Been thanked: 2 times

Re: Javascript error when adding a new record

Unread post by Paul »

Perhaps a fresh installation of nuBuilder is in order?
kev1n
nuBuilder Team
Posts: 4516
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 515 times
Contact:

Re: Javascript error when adding a new record

Unread post by kev1n »

Paul wrote: Fri Sep 26, 2025 7:43 am Wait, I missed that the error is now different:

Uncaught Error: Syntax error, unrecognized expression: #
Any more details in the developer console?
Paul
Posts: 60
Joined: Mon Aug 25, 2025 6:03 am
Has thanked: 13 times
Been thanked: 2 times

Re: Javascript error when adding a new record

Unread post by Paul »

Uncaught Error: Syntax error, unrecognized expression: #
at I.error (jquery-3.7.1.min.js:2:11769)
at Y (jquery-3.7.1.min.js:2:17234)
at re (jquery-3.7.1.min.js:2:20008)
at ce.I [as find] (jquery-3.7.1.min.js:2:7520)
at ce.fn.init.find (jquery-3.7.1.min.js:2:21991)
at new ce.fn.init (jquery-3.7.1.min.js:2:22483)
at ce (jquery-3.7.1.min.js:2:1077)
at nuSetBrowseColumns (nuform.js?ts=20250926074140:4948:46)
at nuDragTitleEvents (nucommon.js?ts=20250926074140:2150:2)
at nuBuildForm (nuform.js?ts=20250926074140:146:2)

Explanation

Understanding the problem
This error message, Syntax error, unrecognized expression: #, indicates that jQuery is attempting to select an element using a CSS selector that is just #. This is an invalid selector because the # symbol in CSS is used to target an element by its ID, and it must be followed by the ID string. When used alone, jQuery doesn't know what element to select, resulting in a syntax error.

Based on the provided stack trace, the issue appears to be originating from the nuSetBrowseColumns function within your nuform.js file. This function is likely receiving or constructing a selector that is just # and passing it to a jQuery function like find() or $(...), causing the error. This can sometimes happen with libraries or frameworks that dynamically build selectors, particularly when dealing with elements that might have empty or missing href or data-target attributes [1].

Suggested fix
Review the nuSetBrowseColumns function in nuform.js. Specifically, look for instances where jQuery is being used to select an element, and check the value of the selector being used. Ensure that any selector starting with # is followed by a valid element ID. If you are dynamically generating the selector, add a check to ensure that the ID is not empty or null before using it in the jQuery selector.
kev1n
nuBuilder Team
Posts: 4516
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 515 times
Contact:

Re: Javascript error when adding a new record

Unread post by kev1n »

Try placing your Custom Code in the 'Edit' field instead of using 'Browse & Edit'
Post Reply