Welcome to the nuBuilder Forums!

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

nubuuilder does not save new records

Questions related to using nuBuilder Forte.
Post Reply
calida82
Posts: 58
Joined: Mon Sep 09, 2019 8:20 am

nubuuilder does not save new records

Unread post by calida82 »

i am using nubuilder i dont like alphanumeric primary keys so i created the tables manually with phpmyadmin but i have a problem.
when I want to add a new record even if I don't fill in all the fields the record is not saved. why does this happen?
when I save the popup record saved appears but this does not happen. Why?
i also want some fields to autofill with this function in custom code

Code: Select all

function nuBeforeSave(){
    nuSetValue('mar_tipo','VETTURA'));
}
but that doesn't seem to work either
nc07
Posts: 118
Joined: Tue Jun 04, 2019 4:05 am
Has thanked: 5 times
Been thanked: 22 times

Re: nubuuilder does not save new records

Unread post by nc07 »

Hi Calida82,
With regards to the record not saving, are you using auto increment and is the primary key set in mysql. can you show the the table structure?
Do you see any result in the debug.Kindly provide further information so we can assist you better.

To set Default value, You can do something like below.

Code: Select all

 if (nuFormType() == 'edit' ){
    $('#field_id').val(defaultvalue).change();
  
     nuHasNotBeenEdited();
    }
Nilesh
calida82
Posts: 58
Joined: Mon Sep 09, 2019 8:20 am

Re: nubuuilder does not save new records

Unread post by calida82 »

I think I understand why. in my of the fields are all set to not null so if I don't fill in the field the error is generated because I try to insert a null field in the db which does not accept null. For the moment I solved it like this. in the onchange event of the only required field I wrote this

Code: Select all

if (nuIsNewRecord()){
   nuSetValue('cli_citta','');
   nuSetValue('cli_indirizzo','');
   nuSetValue('cli_telefono','');
   nuSetValue('cli_email','');
}
questo sembra risolvere il problema
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: nubuuilder does not save new records

Unread post by kev1n »

calida82 wrote: Wed Aug 16, 2023 8:15 am because I try to insert a null field in the db which does not accept null.
Wouldn't it be a viable option to set NULL as the default for the columns?
calida82
Posts: 58
Joined: Mon Sep 09, 2019 8:20 am

Re: nubuuilder does not save new records

Unread post by calida82 »

the fields in database are set to not null
Post Reply