How are you including the liveview component in your page?
Just tested your code and it works fine https://i.imgur.com/8n4MOyi.png
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi all,
Happy Friday!
I have a Jetstream install and have setup a couple of routes:
Route::middleware(['verified'])->prefix('tasks')->group(function () {
Route::get('', [Tasks::class, 'render']);
Route::get('create', [AddTask::class, 'render']);
});
Pointing to two different Livewire classes. So the index page showing tasks works and navigating to the create page works, however when trying to submit the form it doesn't work...So what am I missing?
class AddTask extends Component
{
public $task = '';
public $alerts = '';
protected $rules = [
'body' => 'required',
'alerts' => 'required',
];
public function render()
{
return view('livewire.add-task');
}
public function save()
{
dd('testing');
}
}
Then the form I have:
<form wire:submit.prevent="save">
<div class="px-4 py-5 bg-white sm:p-6">
<div class="col-span-12 sm:col-span-6">
<x-jet-label for="current_password" value="Task" />
<x-form-input type="textarea" wire:model="task" class="mt-1 block w-full" />
@error('body') <span class="text-red-700">Task field is required</span> @enderror
</div>
<div class="col-span-12 sm:col-span-6 mt-2">
<x-jet-label for="current_password" value="Do you want alerting?" />
<div class="relative">
<select wire:model="alerts" class="mt-1 block appearance-none w-full border border-gray-200 text-gray-700 py-3 px-4 pr-8 rounded leading-tight focus:outline-none focus:bg-white focus:border-gray-500" id="grid-state">
<option value="">Please select</option>
<option>Yes</option>
<option>No</option>
</select>
<div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/></svg>
</div>
</div>
@error('alerts') <span class="text-red-700">Do you want an alert?</span> @enderror
</div>
</div>
<div class="flex items-center justify-end px-4 py-3 bg-gray-50 text-right sm:px-6">
<button type="submit" class="inline-flex justify-center py-2 px-4 border border-transparent text-sm leading-5 font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-500 focus:outline-none focus:border-indigo-700 focus:shadow-outline-indigo active:bg-indigo-700 transition duration-150 ease-in-out">
Save
</button>
</div>
</form>
Put it doesn't submit to see the dd() and just adds a ? to the end of the URL tasks/create?
What am I missing here?
Please or to participate in this conversation.