What seems to be the problem:
I am trying to setup a default value for input field so that when I click submit, it would create a new page and set the kanban_id
to the current kanban_id
<form>
<input type="hidden" id="kanban_id" name="kanban_id" wire:model.defer="kanban_id" value="{{$kanban->id}}">
<button type="submit" wire:click="addPage">
Add
</button>
</form>
In the livewire component, I have this function
public $kanban_id;
// When I set this manually everything works, but I want it to grab the kanban_id from blade.
public function mount()
{
$this->kanban_id = 1;
}
public function addPage()
{
$this->title='new-project-page';
$this->order='1';
$this->status='1';
$record = $this->validate([
'kanban_id' => 'required',
'title' => 'required',
'order' => 'required',
'status' => 'required'
]);
Page::create($record);
$this->resetInputFields();
}
I did try this entire approach
This is a quick 15 second gif of what I am trying to get to work.
Any help or insight is much apprciated