How to default field to today's date?

Tips submitted by PHPMaker users
Post Reply
garydauphin

How to default field to today's date?

Post by garydauphin »

I have a table with a date field. In the PHPmaker Add page, I would like to have that field default to today's date. Does anyone have a clue how to accomplish this? (I do not know JavaScript, but I do know PHP if that will help).

Thanks,

Gee


Gee Deezy

Post by Gee Deezy »

Answered my own question:

in the default field, simply put:

date("m/d/Y")

making sure that the date is output if the correct format you need it. For details, see the PHP manual on the DATE command.


nadimsia

Post by nadimsia »

How about if I want to update due today date when I edit the data. Because there is no 'default value' on edit page (On PHPMAKER application).


ldozois

Post by ldozois »

Set your date value in the row_updating event.


peach

Post by peach »

You can add the following php code in the Default Value field under the Add Page section: date("Y-m-d H:i:s");


watanyu.y
User
Posts: 1

Post by watanyu.y »

For default value of the field in Add Page section, I set it to the function ew_CurrentDate().


inside83
User
Posts: 62

Post by inside83 »

Gee Deezy wrote:
Answered my own question:

in the default field, simply put:

date("m/d/Y")

making sure that the date is output if the correct format you need it. For
details, see the PHP manual on the DATE command.
THANK YOU


buhuhu
User
Posts: 203

Post by buhuhu »

how can add that in EDIT page ?

Regards,


joubertjg
User
Posts: 66

Post by joubertjg »

In Server Events / Table-Specific / Common

Row_Rendered add

if ( CurrentPageID() == "edit" ) {

$this->Your_Field_Name->EditValue = date("Y-m-d");

}


Post Reply