How to mimic create action?
So i have 2 button, the default create form action and save as draft, i want save as draft is 99% same with the normal one, the only difference is the status how do i do that? i've tried this but i have to manually give validation how do i mimic the original one?
10 Replies
Save as draft would skip validation as if it's a draft it's unfinished, if it's unfinished you will have required fields. I would suggest for what you want, you make the input fields live and ensure they are validated on the input.
I reccomend somethng like this:
i tried that but somehow i didnt get status_project from the action, do you know why? here is my code
$data only contains the data from a submitting form.... There is no form in the above action? if you DD on the action, do you have the form data?
thank you for the answer, so i have the form but there is no status_project field, because i want status_project field automatically generated. how do i do that?
Just set it as per the above and ensure it is fillable in the model
but when i dd the $data the "status_project" is not appearing, im thinking to do this one instead of mutateForm but idk if this is the best practice or nah
You need to put it in the mutateBeforeCreate if using the creation action, otherwise it's fine
okay thank you so muchh for answering my question
First of all, you need a record which means Edit Page in this case
If you are creating, then there isnt really a record to begin with