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
Sorry, but read #✅┊rules and put some effort into your question.
I must use GitHub?
Not sure where you read this. But 1 one-liner with a bad screenshot of your. code is not really intriguing.
Ok sorry for this i will modify this and delete screenshot
i update it its correct now?
can't you just use a checkboxlist?
You forgot the code styling.
Not sure what you are trying but it looks like you are heavily abusing the Placeholder
i want to have this view and select ids element
how do it please?
not work inside a function
What is not working dude