简体   繁体   中英

Prestashop Module Form creation

I want to add 21 checkboxes and a text field(Name) in a good design way. Also there must be "check all button" to check all the checkboxes, how to do it in module PHP page in prestashop.

Since I am new to prestashop I don't know about the form submission, I have to save these two fields together as a json array in database.

Is that possible in prestashop? please help me regarding this.

prestashop version = 1.6

Thanks in advance

Sample code

protected function getConfigForm()
{
    return array(
        'form' => array(
            'legend' => array(
                'title' => $this->l( 'Generate Export Order Settings' ),
                'icon' => 'icon-cogs'
            ),
            'input' => array(
            array(
                'type' => 'checkbox',
                'name' => 'display',
                'values' => array(
                    'query' => array(
                        array(
                            'id' => 'all_fields',
                            'name' => $this->l('All Fields'),
                            'val' => '1'                                
                        ),
                    ),
                    'id' => 'id',
                    'name' => 'name'
                )
            ),
            ),
            'submit' => array(
                'title' => $this->l( 'Save Export Settings' ),
                'class' => 'button pull-right',
                'name' => 'save-main-display-settings',
            )
        ),
    );
}

I don't know how to add check box in 3 columns and 7 rows and select all button to select all the checkbox.

You can use the following JS code to add check all functionality:

$('.chk_boxes').click(function(){
    var chk = $(this).attr('checked')?true:false;
    $('.chk_boxes1').attr('checked',chk);
});

Fiddle here: http://jsfiddle.net/HBGzy/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM