Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Framework » Default value - changing when inserting new record
Default value - changing when inserting new record [message #7899] Wed, 05 February 2025 05:05 Go to next message
htManager is currently offline  htManager
Messages: 452
Registered: May 2014
Senior Member
Hi Tony,

I have a field with type tinyint(1) and default value "1". In some cases I want to change the value to “0”, when inserting a new record. But this change is not accepted.
I tried it analogously to the "UML diagram for Add 1" in the functions _cm_pre_InsertRecord(), _cm_post_InsertRecord() and in _cm_formatData() but in the end the value '1' is always entered.
I have currently deleted the default value and am checking in _cm_post_InsertRecord() which value I need to enter.
Is this behavior desired by the framework? Or in which function do I have to change the default value?
Re: Default value - changing when inserting new record [message #7900 is a reply to message #7899] Thu, 06 February 2025 06:35 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2378
Registered: April 2006
Location: Surrey, UK
Senior Member
I have managed to replicate this issue and found the offending code. In file std.table.class.inc you will see lines 6890 and 6891 as follows:
} elseif (empty($insertarray[$field]) AND !empty($spec['default'])) {
    $insertarray[$field] = $spec['default'];
If you either remove these lines or comment them out your problem should disappear.


Re: Default value - changing when inserting new record [message #7901 is a reply to message #7900] Thu, 06 February 2025 07:29 Go to previous message
htManager is currently offline  htManager
Messages: 452
Registered: May 2014
Senior Member
Thank you very much. I will do this.
Previous Topic: Printing Σ (Sigma) not possible in PDF
Next Topic: Tab order in Radicore screen
Goto Forum:
  


Current Time: Sat Feb 22 14:38:44 EST 2025

Total time taken to generate the page: 0.01147 seconds