F
Filament11mo ago
freekdz

add input to form

Please how can add the input checkbox data in my state form "I want to add the selected IDs to the state when I click the 'Add' button, in order to subsequently add all the forms to the table." if ($isMultiline) { Step::make('Disponibilites') ->schema([ Placeholder::make('') ->content(function () { $disponibiliteRecords = Disponibilites::all(); echo '<table>'; echo '<tr>'; $count = 0; foreach ($disponibiliteRecords as $disponibilite) { echo '<td>'; echo '<p style="margin-right:130px;"></p>'; echo '<p style="margin-bottom:20px;"></p>'; echo '<p>'. $disponibilite->code .'</p>'; echo '<p><img src="' . asset('storage/uploads/'.$disponibilite->image) . '" alt="Image"></img></p>'; echo '<p>' . $disponibilite->commune_name . '</p>'; echo '<p>' . $disponibilite->adresse . '</p>'; echo '<input type="checkbox" data-id="' . $disponibilite->id . '">'; echo '</td>'; $count++; if ($count % 3 === 0) { echo '</tr><tr>'; // Nouvelle ligne après chaque 2e élément } } // Fermer la dernière ligne si nécessaire if ($count % 3 !== 0) { echo '</tr>'; } echo '</table>'; }), Actions::make([ Action::make('Ajouter') ->icon('heroicon-m-x-mark') ->action(function (Set $set, $state) { dd($state); }), ]), ]); }
9 Replies
Dennis Koch
Dennis Koch11mo ago
Sorry, but read #✅┊rules and put some effort into your question.
freekdz
freekdz11mo ago
I must use GitHub?
Dennis Koch
Dennis Koch11mo ago
Not sure where you read this. But 1 one-liner with a bad screenshot of your. code is not really intriguing.
freekdz
freekdz11mo ago
Ok sorry for this i will modify this and delete screenshot i update it its correct now?
wyChoong
wyChoong11mo ago
can't you just use a checkboxlist?
Dennis Koch
Dennis Koch11mo ago
You forgot the code styling. Not sure what you are trying but it looks like you are heavily abusing the Placeholder
freekdz
freekdz11mo ago
i want to have this view and select ids element
freekdz
freekdz11mo ago
how do it please? not work inside a function
wyChoong
wyChoong11mo ago
What is not working dude