Page 1 of 1

Value not saved

Posted: Mon Jan 22, 2018 9:27 pm
by ltrannoy
Hello,

When I update the value of a field (fiedl02) from an event (onchange) of another field (field01), the value is displayed but is not stored in the database when the we submit the form.
Example :
Field01 field:
     onchange: $ ('# field02'). val ('TEST' ');
Field02 field:
   Display the value "TEST" correctly
Activation of the [Save] button
Result :
The value "TEST" is not stored in the table.

Thank you for your help.

Re: Value not saved

Posted: Mon Jan 22, 2018 10:31 pm
by admin
ltrannoy,

When did you find this happen?

When did you last update from Github?

Steven

Re: Value not saved

Posted: Mon Jan 22, 2018 11:03 pm
by ltrannoy
My last update is 16 jan 2018.

thanks

Re: Value not saved

Posted: Tue Jan 23, 2018 12:14 am
by pyro
Hi ltrannoy,

not really a solution but try to add the following code:

Code: Select all

function nuBeforeSave(){
return true;
}
I have the same issue with my datetime field https://forums.nubuilder.cloud/viewtopic.php?f=19&t=9255 however for some reason it works if I call the nuBeforeSave function.

Re: Value not saved

Posted: Tue Jan 23, 2018 1:58 am
by admin
pyro,

I believe your problem was different, I've answered it here.. http://forums.nubuilder.cloud/viewtopic.php?f=19&t=9255

Steven

Re: Value not saved

Posted: Tue Jan 23, 2018 2:08 am
by admin
ltrannoy,

I just wanted to know if it had anything to do with any changes I have made today.


Your question is a good one.

Your problem is that once you have updated a field with code, you need to run change() on the updated Object.

Code: Select all

$('# field02').val('TEST').change();
This lets nuBuilder know that this Object has been edited so that it will be saved.

(Only edited Objects are saved by nuBuilder)

Steven

Re: Value not saved

Posted: Tue Jan 23, 2018 9:29 pm
by ltrannoy
Thanks for your help.

Laurent

Re: Value not saved

Posted: Tue Jan 23, 2018 10:45 pm
by admin
.