Startdate EndDate

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
sardar_sajjad
User
Posts: 6

Startdate EndDate

Post by sardar_sajjad »

Dear Reader

I have two fields out of many in a table

1) Startdate
2) Enddate

I want while add/edit record

-Startdate is not less then system date but it may be current/future date.
-Enddate is not less then system date as well as not less than startdate.

Kindly Advise.

Sajjad


mobhar
User
Posts: 11717

Post by mobhar »

Simply put the following code in "Row_Inserting" and "Row_Updating" server events:

if (strtotime($rsnew["Startdate"]) < strtotime(ew_CurrentDateTime())) {
$this->setFailureMessage("Start Date must be greater or equal to the current Date Time.");
return FALSE;
}

if ( strtotime($rsnew["Startdate"]) > strtotime($rsnew["Enddate"]) ) {
$this->setFailureMessage("End Date must be greater or equal to Start Date.");
return FALSE;
}


sardar_sajjad
User
Posts: 6

Post by sardar_sajjad »

Hi,

Thank you, it works.

Sajjad


Post Reply