How to check mode create or mode edit in form ?
I have a case
if form mode create then validate A
if form mode edit then validate B
But current form alway go validate A
The label have been change to email 2
I have been debugged ID alway is NULL before it is a numeric after submitting form @z-song
:(
The method update of trait ModelForm will handle update request, so you always get NULL because in update method there is no parameters passed to form method.
The only thing you need to do is just override the update method in your controller, and pass id to form method.
Thanks for your support
Can you give some line of code to help me ?
Just add following code to your controller:
public function update($id)
{
return $this->form($id)->update($id);
}
IT works thank you
Most helpful comment
Just add following code to your controller: