简体   繁体   English

Prestashop模块表单创建

[英]Prestashop Module Form creation

I want to add 21 checkboxes and a text field(Name) in a good design way. 我想以一种良好的设计方式添加21个复选框和一个文本字段(名称)。 Also there must be "check all button" to check all the checkboxes, how to do it in module PHP page in prestashop. 还必须有“检查所有按钮”以检查所有复选框,以及如何在prestashop的模块PHP页面中进行检查。

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. 由于我不熟悉prestashop,所以我不了解表单提交,因此必须将这两个字段一起保存为数据库中的json数组。

Is that possible in prestashop? 在prestashop中这可能吗? please help me regarding this. 请帮助我。

prestashop version = 1.6 prestashop版本= 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. 我不知道如何在3列和7行中添加复选框,然后选择全部按钮以选中所有复选框。

You can use the following JS code to add check all functionality: 您可以使用以下JS代码添加检查所有功能:

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

Fiddle here: http://jsfiddle.net/HBGzy/ 在这里提琴: http : //jsfiddle.net/HBGzy/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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