Page 1 of 1

nubuuilder does not save new records

Posted: Mon Aug 14, 2023 5:36 pm
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

Re: nubuuilder does not save new records

Posted: Tue Aug 15, 2023 9:51 pm
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

Re: nubuuilder does not save new records

Posted: Wed Aug 16, 2023 8:15 am
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

Re: nubuuilder does not save new records

Posted: Wed Aug 30, 2023 7:46 am
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?

Re: nubuuilder does not save new records

Posted: Sat Sep 02, 2023 11:35 pm
by calida82
the fields in database are set to not null