Form Data is Not Saved When I Click the Print Button: How Do I Fix It?

I am entering new data during the wizard, but the data is old because it has not been updated yet, so the backend pulls the old data when printing. Do I have a chance to send this data to BE? Or how can I do this printing job in the form wizard with current data?
No description
No description
No description
4 Replies
toeknee
toeknee3w ago
If you want it to save running the standard save functionality? $record->update($data) maybe too?
Mehmet K.
Mehmet K.3w ago
array data is empty that's why is not working. My solution is
->action(function (Shipment $record, Forms\Get $get, Component $livewire) {
$customerNameSend = $get('sender_name');
$customerTitleSend = $get('note_title');
$customerNoteSend = $get('customer_note');

$params = [
'id' => $record->id,
'sender_name' => $customerNameSend,
'note_title' => $customerTitleSend,
'customer_note' => $customerNoteSend,
];
$url = url('print/generate') . '?' . http_build_query($params);

// JavaScript ile yeni sekmede aç
$livewire->js("window.open('$url', '_blank');");
->action(function (Shipment $record, Forms\Get $get, Component $livewire) {
$customerNameSend = $get('sender_name');
$customerTitleSend = $get('note_title');
$customerNoteSend = $get('customer_note');

$params = [
'id' => $record->id,
'sender_name' => $customerNameSend,
'note_title' => $customerTitleSend,
'customer_note' => $customerNoteSend,
];
$url = url('print/generate') . '?' . http_build_query($params);

// JavaScript ile yeni sekmede aç
$livewire->js("window.open('$url', '_blank');");
Matthew
Matthew3w ago
Send it off to a handler to save all the $data properly before firing your print class.
toeknee
toeknee3w ago
data only has a value when it is submitted to action.
Want results from more Discord servers?
Add your server