[SOLVED] Creating draft pages
Posted 26 April 2019 - 11:42 PM
I have an area that staff put in case notes. I have implemented an autosave via ajax to the edit page. I would like to do this on the add page but of course do not have a record ID yet to make sure the proper record is updated. I was thinking of implementing some type of draft page that gets saved via ajax and then when the staff member actually hits add record on the add page it gets added normally. Has anyone tackled this?
Thanks for any input.
Posted 28 April 2019 - 07:18 PM
1. Add a new yes/no field to the table in question, name it "draft" for instance. Draft records will have 'yes' in this field, actual records will have 'no' there. Make sure that on the list page only actual records are displayed.
select ... from ... WHERE draft='no'
2. Add page: BeforeProcess event. Create a new record, set draft='yes', redirect user to the Edit page of this record.
3. When record is saved on the Edit page add the following to BeforeEdit event:
Posted 01 May 2019 - 01:41 AM
Before record added (add page)
$values['Status']='Draft'; return true;
Before record added (edit page)
$values["Status"]='Published'; return true;
After record added (add page)
header("Location: tCaseNote_edit.php?editid1=".$values['ID']); exit();
Is there a better way to do this? It is not that smooth.