© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
9 replies
krekas

get updated property value in view form field

In the simple page I have a public property
public int $strengthScore = 0;
public int $strengthScore = 0;


I set it using the
$set
$set
method.

TextInput::make('password')
  ->live()
  // other rules
  ->hintAction(
      Action::make('generate')
          ->label('Generate')
          ->action(function (Set $set, Get $get) {
              $password = Str::password(12);
              $set('password', $password);
              $set('passwordConfirmation', $password);
              $set('strengthScore', (new Zxcvbn())->passwordStrength($password)['score']);
          }),
  );
TextInput::make('password')
  ->live()
  // other rules
  ->hintAction(
      Action::make('generate')
          ->label('Generate')
          ->action(function (Set $set, Get $get) {
              $password = Str::password(12);
              $set('password', $password);
              $set('passwordConfirmation', $password);
              $set('strengthScore', (new Zxcvbn())->passwordStrength($password)['score']);
          }),
  );


But how to get
strengthScore
strengthScore
value in the ViewField after it is updated?

Tried
$wire.$entangle
$wire.$entangle
in the
x-data
x-data
but it get only the initial value.
<div x-data="{ strengthScore: $wire.$entangle('strengthScore', live = true) }">
    <progress value="{{ $this->strengthScore }}" max="4" class="w-full"></progress>
</div>
<div x-data="{ strengthScore: $wire.$entangle('strengthScore', live = true) }">
    <progress value="{{ $this->strengthScore }}" max="4" class="w-full"></progress>
</div>
Solution
Sending event:
$score = (new Zxcvbn())->passwordStrength($password)['score'];
$set('strengthScore', $score);
$this->dispatch('update-score', score: $score);
$score = (new Zxcvbn())->passwordStrength($password)['score'];
$set('strengthScore', $score);
$this->dispatch('update-score', score: $score);
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Wizard form get other input value field
FilamentFFilament / ❓┊help
3y ago
Form field value based on 2 other fields
FilamentFFilament / ❓┊help
13mo ago
Label on form field, custom view
FilamentFFilament / ❓┊help
3y ago
get a field value in an action
FilamentFFilament / ❓┊help
2y ago