Welcome to the nuBuilder Forums!

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

What is the best method to put default in a field ?

Questions related to using nuBuilder Forte.
Post Reply
yvesf
Posts: 315
Joined: Sun Mar 14, 2021 8:48 am
Location: Geneva
Has thanked: 87 times
Been thanked: 11 times

What is the best method to put default in a field ?

Unread post by yvesf »

I would like to initiate a default value for a specific field that I can change when I am in the record.
What is the best method to do that ? directly in the database or in PHP ? how to do that also to put the today's date by default ? I have tried several methods without success unfortunately. Many thanks for your help
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: What is the best method to put default in a field ?

Unread post by kev1n »

Hi,

To set a default value, use JavaScript in the form's Custom Code:
default_value.jpg
how to do that also to put the today's date by default
From the mySQL Reference:
Automatic Initialization and Updating for TIMESTAMP and DATETIME
TIMESTAMP and DATETIME columns can be automatically initializated and updated to the current date and time (that is, the current timestamp).
For any TIMESTAMP or DATETIME column in a table, you can assign the current timestamp as the default value, the auto-update value, or both:
An auto-initialized column is set to the current timestamp for inserted rows that specify no value for the column. Read more...
current_time_default.jpg
You do not have the required permissions to view the files attached to this post.
Post Reply