Need visual composer help - Multiple field's value not saving in one param using add_vc_shortcode_param

wordpress
javascript
tips-and-tricks

#1

I create new parameter foo using add_vc_shortcode_param

 if ( function_exists( 'vc_add_shortcode_param' ) ) {
                vc_add_shortcode_param( 'foo', 'foo_callback', get_template_directory_uri().'/vc_extend/params.js' );
            }

          function foo_callback( $settings, $value ) {

            $dependency = ( function_exists( 'vc_generate_dependencies_attributes' ) ) 
    ? vc_generate_dependencies_attributes( $settings ) : '';
                $defaults = array(
                    'value'      => 'margin-top||5||0||0||0',
                );

                $settings = wp_parse_args( $settings, $defaults );

                $value = ( null == $value ) ? $settings['value'] : $value;

                $margin_data = explode( '||', $value );

                $margin_property    = $margin_data[0];
                $top_val            = ( isset( $margin_data[1] ) ) ? $margin_data[1] : '0';
                $left_val       = ( isset( $margin_data[2] ) ) ? $margin_data[2] : '0';
                $bottom_val     = ( isset( $margin_data[3] ) ) ? $margin_data[3] : '0';
                $right_val          = ( isset( $margin_data[4] ) ) ? $margin_data[4] : '0';

options

 <option class="foo-margin" value="margin" '
    . selected( 'margin', $margin_property, false ) . '>'
. __( 'All', 'vc-extend' ) . '</option>
        and so on....

Four input fields for getting value (top, right, bottom, left)

Problem: Value only save in one field, if field name is esc_attr( $settings[‘param_name’]
How to get field’s value by jquery or javascript and then save value in hidden input field or other suggestion ??


#2

It’s better to contact the author due to forum is for general purposes but not for item support