Page 1 of 1

Conditional field fill - If/Then?

Posted: 2013-08-15 13:20
by rdmiddleton
I have a form with several boxes for initials and date for each step completed. I would like for the date to autofill (current date) when the "initials"(completed by) field is completed.
Ex:
Step1 Completed by ____ On __/__/__
Step2 Completed by ____ On __/__/__
Step3 Completed by ____ On __/__/__
Different people are responsible for each step.

Something like:
Before
If step1 completed by = ""
After
If step1 completed by <>"" then step1 completed on = 'current date'

Any thoughts on how to accomplish this?

Re: Conditional field fill - If/Then?

Posted: 2013-09-23 00:44
by a.gneady
Try using the tablename_before_update hook for this ... for example:

Code: Select all

if($data['step1_completed_by'] != ''){ $data['step1_date'] = date('Y-m-d'); }