I am passing some numeric data through the Bricks form by using a custom action. This number goes to the ajax function and does some calculations. I need this updated number after calculations to be returned back to the page for displaying via JS or even PHP. So far I have not found a way to do this in the documentation. Any help would be appreciated. This is my code:
function my_form_custom_action( $form ) {
$fields = $form->get_fields();
$width= $fields['idpfak'];
$new_width = $width * 1.2;
wp_send_json_success( $new_width );
}
add_action( 'bricks/form/custom_action', 'my_form_custom_action', 10, 1 );
This is otherwise fairly simple and straightforward via vanilla JS where the result of wp_send_json_success()
is used to display on the DOM. But in Bricks, is there no possibility?
Any help would be appreciated. Thanks.