Hello Bricks Team,
I’ve recently started using the bricks/form/custom_action
feature, and it’s been a fantastic addition to my workflow! It’s made things much more efficient. However, I encountered a challenge when trying to pass some “additional data” from the backend to the frontend using the set_result
method. Unfortunately, it seems that this data isn’t accessible on the frontend.
My goal is to pass custom data that the frontend can use for further processing.
Example:
I attempted the following in PHP:
$form->set_result([
'action' => 'my_custom_action',
'type' => 'success',
'message' => esc_html__('Operation successful', 'bricks'),
'additional_data' => 'Some extra information',
]);
On the frontend, I tried accessing this “additional data” using JavaScript:
document.addEventListener('bricks/form/success', function(event) {
console.log('Additional data:', event.detail.res.additional_data);
});
Issue:
The “additional data” is not being passed to the frontend, which limits the ability to implement custom logic based on the server’s response.
Request:
Could you please enhance the set_result
functionality to ensure that “additional data” passed from the backend is accessible on the frontend? This would greatly improve flexibility for developers.
Thank you for considering this request.