Page 1 of 1

How to default field to today's date?

Posted: Wed Jun 01, 2011 8:13 am
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


Re: How to default field to today's date?

Posted: Wed Jun 01, 2011 8:38 am
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.


Re: How to default field to today's date?

Posted: Wed Sep 07, 2011 2:46 pm
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).


Re: How to default field to today's date?

Posted: Wed Sep 14, 2011 11:58 am
by ldozois

Set your date value in the row_updating event.


Re: How to default field to today's date?

Posted: Fri Oct 12, 2012 5:59 am
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");


Re: How to default field to today's date?

Posted: Wed Nov 13, 2013 9:18 am
by watanyu.y

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


Re: How to default field to today's date?

Posted: Wed Apr 27, 2016 4:25 pm
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


Re: How to default field to today's date?

Posted: Mon Aug 01, 2016 3:48 pm
by buhuhu

how can add that in EDIT page ?

Regards,


Re: How to default field to today's date?

Posted: Tue Aug 02, 2016 11:59 am
by joubertjg

In Server Events / Table-Specific / Common

Row_Rendered add

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

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

}