I have below code.


protected function _construct() {
    $this->addButton('select', array(
        'before_html' => '<form name="frm" id="frm" method="post" action=""><input name="form_key" type="hidden" value="' . $this->getFormKey() . '"/>',
        'label' => __('Select'),
        'type' => 'submit',
        'name' => 'select',
        'id' => 'select',
        'value' => 1,
        'after_html' => '</form>',


 protected function _prepareColumns() {

                    'id', [
                'header_css_class' => 'a-center',
                'type' => 'checkbox',
                'name' => 'id',
                'align' => 'center',
                'index' => 'id',
                'values' => array(3,4),

                    'qty_succeed[]', [
                'header' => __('Qty'),
                'type' => 'input', // Change to Input
                'index' => 'qty_succeed',
                'editor' => 'text',

I'm not using _prepareMassaction function as I'm not able to achieve needed functionality.

When clicked on "Select" button it should pass all values in Array so I can validate in Controller.

Question 1 How to add form on listing portion only? Because _prepareMassaction is not taking textbox values. It only takes checkbox values

Question 2 How to select main checkbox as well from Listing?

enter image description here

1 Answer 1


For both mass action and regular button you can use javascript to trigger a function, which can then collect whatever form values you want and submit them to server. This is the simplest way to go in this case.

  • But there is no Form within the listing portion. How to add form so it takes textbox value as well
    – Jackson
    Mar 28, 2017 at 8:48
  • To collect inputs values you don't need a form, all you need is something like: $('div.your_listing_class input[type=text]').each( function(){ return $(this).val() }) Mar 28, 2017 at 8:52
  • I need row wise things Checkbox with Texbox value so I can put on 'onclick' event of button
    – Jackson
    Mar 28, 2017 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.