Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Error in function nuSetTitle() Topic is solved

Questions related to customising nuBuilder Forte with JavaScript or PHP.
mih
Posts: 30
Joined: Thu Jan 26, 2023 12:04 pm
Has thanked: 3 times

Error in function nuSetTitle()

Unread post by mih »

Hello.

Function nuSetTitle() doesn't work - form title remains old after calling this function. Only works in popup mode, when there is no "Logout" icon in the breadcrumb line. It seems that because of the "Logout" element (has the nuNotBreadcrumb class), the index for the jQuery call, setting the title, is incorrectly counted.
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Error in function nuSetTitle()

Unread post by kev1n »

Hi,

There's been a fix recently. Not sure if that helps though.

https://github.com/nuBuilder/nuBuilder- ... b870c8d90a
mih
Posts: 30
Joined: Thu Jan 26, 2023 12:04 pm
Has thanked: 3 times

Re: Error in function nuSetTitle()

Unread post by mih »

in github diff there is one version, but version in release archive is different

I've got an error within nuform.js version in release archive.

I suggest to substract $('#nuLogout').length then counting index.

Or, if class '.nuNotBreadcrumb' is assigned only to the LAST item in breadcrumb, count only $(''.nuBreadcrumb').length.
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Error in function nuSetTitle()

Unread post by kev1n »

You also need the current nubuilder4.css
mih
Posts: 30
Joined: Thu Jan 26, 2023 12:04 pm
Has thanked: 3 times

Re: Error in function nuSetTitle()

Unread post by mih »

OK. The latest release has an older version of css. Is it safe to use the latest 'master' branch (not yet included in the release)?
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Error in function nuSetTitle()

Unread post by kev1n »

You may use the master branch or just use its updated nuform.js, nubuilder4.css
vario
Posts: 148
Joined: Mon Dec 05, 2011 12:23 pm
Location: Newton Abbot, UK
Has thanked: 1 time
Been thanked: 1 time

Re: Error in function nuSetTitle()

Unread post by vario »

I just noticed this issue. Copied nuform.js & nubuilder4.css from master but doesn't work. Is there a fix available?

DB Version: V.4.5-2023.02.21.01
Files Version: V.4.5-2023.02.21.00
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Error in function nuSetTitle()

Unread post by kev1n »

I'm sorry to hear that the nuSetTitle() function is not working as expected. To better assist you, I would need more information about the specific context in which you're using this function.

Are you using nuSetTitle() on a main form or a popup form, Browse, Edit, etc?
Are there any error messages in the browser's console after calling the function?
A screenshot could help as well.

Once I have more information about your implementation, I'll be better equipped to help you troubleshoot and find a solution to your issue.
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Error in function nuSetTitle()

Unread post by kev1n »

Try the latest nuform.js and let me know if it works for you.
vario
Posts: 148
Joined: Mon Dec 05, 2011 12:23 pm
Location: Newton Abbot, UK
Has thanked: 1 time
Been thanked: 1 time

Re: Error in function nuSetTitle()

Unread post by vario »

I'm using it in the "Custom Code" section of the form to change the breadcrumb on edit forms, for example

Code: Select all

if (nuFormType() == 'edit'){
 nuSetTitle($('#emp_forename').val()+' '+$('#emp_surname').val());
 }
If I use the nuform.js from github master, the login screen is visible (though badly formatted if I also use the new nubuilder4.css) and I cannot get the application to load. The following (abbreviated) messages are in the console:

Code: Select all

Uncaught SyntaxError: expected expression, got '<'

Uncaught ReferenceError: nuUXOptions is not defined (from index.php:112)

Uncaught ReferenceError: nuMainForm is not defined (from index.php: 204)

Uncaught ReferenceError: nuBuildForm is not defined
I'm running on Arch Linux with PHP 8.2.4 & Apache 2.4.56

Neil.
Post Reply