Page 5 of 5

Re: Javascript error when adding a new record

Posted: Sat Sep 27, 2025 6:59 am
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)

Re: Javascript error when adding a new record

Posted: Sat Sep 27, 2025 7:16 am
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.

Re: Javascript error when adding a new record

Posted: Sat Sep 27, 2025 7:19 am
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.

Re: Javascript error when adding a new record

Posted: Sat Sep 27, 2025 7:57 am
by Paul
Fixed. Done. I don't have to re-invent the wheel. Yay.