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 Topic is solved

Questions related to customising nuBuilder Forte with JavaScript or PHP.
kev1n
nuBuilder Team
Posts: 4526
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 517 times
Contact:

Re: Javascript error when adding a new record

Unread post by kev1n »

It’s a bit strange that the Select object/SQL is causing problems for you.
But you can always fall back on JavaScript:

Code: Select all

if (!nuIsNewRecord) {
   nuSetValue('pk_inv_case_no', nuRecordId());
}
(Add this under Custom Code → Edit Field)
Paul
Posts: 76
Joined: Mon Aug 25, 2025 6:03 am
Has thanked: 16 times
Been thanked: 2 times

Re: Javascript error when adding a new record

Unread post by Paul »

'pk_inv_case_no' is the Primary key and is auto-incremented. Is it safe/advisable to use it as you described above? I am afraid of causing issues as before. I think displaying it in the browse form is ok, but I hesitate using it in the edit form.
kev1n
nuBuilder Team
Posts: 4526
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 517 times
Contact:

Re: Javascript error when adding a new record

Unread post by kev1n »

The real issue is likely that the PK field is (or was) tied to a field with the same name as the column (pk_inv_case_no), which seems to be the root cause of the problems you experienced. If you assign the select object a different ID (e.g., pk_inv_case_no_2) and use SQL to display the record number, the issues should disappear.
Paul
Posts: 76
Joined: Mon Aug 25, 2025 6:03 am
Has thanked: 16 times
Been thanked: 2 times

Re: Javascript error when adding a new record

Unread post by Paul »

Fixed. Done. I don't have to re-invent the wheel. Yay.
Post Reply