Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 4 years ago.
Improve this questionI had A custom PHP template for wpForm. there is checkbox for multiples value selection as stated in my template. When I Submit, the form will trigger "add_action( 'wpforms_process_complete', 'sendData', 10, 4 );" . And I would like to check the value and modify as I need to pass to external service via json. How can I get "Checked" value?
This is my template code:
public function init() {
// Template name
$this->name = 'Registration';
// Template field and settings
$this->data = array (
'field_id' => 14,
'fields' => array (
2 => array (
'id' => '2',
'type' => 'name',
'label' => 'Company Name',
'format' => 'simple',
'required' => '1',
'size' => 'large',
)
11 => array (
'id' => '11',
'type' => 'checkbox',
'label' => 'Options',
'choices' => array (
1 => array (
'label' => 'delivery',
),
2 => array (
'label' => 'walk-in',
)
),
'required' => '1',
'choices_images_style' => 'modern',
'input_columns' => 'inline',
),
);
}
This is my submit triggered function :
add_action( 'wpforms_process_complete', 'sendData', 10, 4 );
function sendData( $fields, $entry, $form_data, $entry_id) {
//The JSON data.
$jsonData = array(
'companyName' => $fields['2']['value']
'option' => $fields['11']['value']
);
}