admin管理员组

文章数量:1333635

Closed. This question is off-topic. It is not currently accepting answers.

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 question

I 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']

  );

   }

本文标签: phpWordPress wpform plugin submit and get multiple checked value from checkbox