You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when I click on the p element, the render function is triggered because of the use of @this.addressr='{{$address['id']}}'
I want to prevent that from happening.
My initial plan was to set the value of a hidden input element. But I realised that hidden element values are not pushed to the livewire class.
I then created a readonly input of type text. Still the property was not being passed to the controller.
Here is the controller.
<?php
namespace App\Http\Livewire;
use App\Http\Controllers\AddressrController;
use Illuminate\Http\Request;
use Livewire\Component;
use LivewireUI\Modal\ModalComponent;
class CreateAddress extends ModalComponent
{
public $query = '';
public $name, $company, $addressr, $phone, $email;
public $addresses=[];
public function mount()
{
$this->addressr = "";
}
public function setAddressr($addressr)
{
$this->addressr = $addressr;
}
public function updatedQuery()
{
$this->addresses = AddressrController::search($this->query);
}
public function render()
{
return view('livewire.create-address', ['addresses' => $this->addresses]);
}
public function create()
{
$this->closeModal();
}
}
This discussion was converted from issue #231 on May 23, 2022 17:51.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
How do I use
@this.property
to set the value of a property without triggering the render function.This is the code I have
when I click on the p element, the render function is triggered because of the use of
@this.addressr='{{$address['id']}}'
I want to prevent that from happening.
My initial plan was to set the value of a hidden input element. But I realised that hidden element values are not pushed to the livewire class.
I then created a readonly input of type text. Still the property was not being passed to the controller.
Here is the controller.
And the html
Also, you can see in the comments. I tried to use
wire:click="$set('addressr','{{$address['id']}}')"
and the same thing happensBeta Was this translation helpful? Give feedback.
All reactions