How to default field to today's date?

Tips submitted by PHPMaker users

How to default field to today's date?

Postby garydauphin » Wed Jun 01, 2011 8:13 am

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
garydauphin
 

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

Postby Gee Deezy » Wed Jun 01, 2011 8:38 am

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.
Gee Deezy
 

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

Postby nadimsia » Wed Sep 07, 2011 2:46 pm

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).
nadimsia
 

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

Postby ldozois » Wed Sep 14, 2011 11:58 am

Set your date value in the row_updating event.
ldozois
 

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

Postby peach » Fri Oct 12, 2012 5:59 am

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

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

Postby watanyu.y » Wed Nov 13, 2013 9:18 am

For default value of the field in Add Page section, I set it to the function ew_CurrentDate().
watanyu.y
 
Posts: 1
Joined: Wed Nov 13, 2013 9:15 am

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

Postby inside83 » Wed Apr 27, 2016 4:25 pm

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
inside83
 
Posts: 54
Joined: Mon Mar 04, 2013 12:26 pm

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

Postby buhuhu » Mon Aug 01, 2016 3:48 pm

how can add that in EDIT page ?

Regards,
buhuhu
 
Posts: 68
Joined: Mon Nov 19, 2012 5:26 pm

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

Postby joubertjg » Tue Aug 02, 2016 11:59 am

In Server Events / Table-Specific / Common

Row_Rendered add

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

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

}
joubertjg
 
Posts: 36
Joined: Tue Sep 02, 2014 7:59 pm


Return to User Submitted Tips (PHPMaker)