0
我想根據更改後臺表單中的下拉列表來顯示或隱藏一些字段,這是nit html表單,它的prestashop後臺助手類形式通過選擇prestashop助手類中的下拉列表顯示下拉字段後臺格式
如果選擇類型是「類別」在第一個下拉列表中,那麼它應該顯示(選擇類別)的下拉列表並且應該隱藏其他兩個下拉列表(選擇產品,選擇提供)。
$this->fields_form = array(
'legend' => array(
'title' => $this->l('My Back offie form:'),
'image' => _PS_ADMIN_IMG_ . 'information.png',
),
'input' => array(
array(
'type' => 'select',
'label' => $this->l('Select Type'),
'name' => 'slider_type',
'id' => 'slider_type',
'options' => array(
'query' => $slidertypes_option,
'id' => 'slider_type',
'name' => 'slider_type'
)
),
array(
'type' => 'select',
'label' => $this->l('Select Category'),
'name' => 'id_category',
'id' => 'id_category',
'options' => array(
'query' => $category_options,
'id' => 'id_category',
'name' => 'category_name'
)
),
array(
'type' => 'select',
'label' => $this->l('Select Offer'),
'name' => 'id_category',
'id' => 'id_category',
'options' => array(
'query' => $offers_options,
'id' => 'id_category',
'name' => 'category_name'
)
),
array(
'type' => 'select',
'label' => $this->l('Select Product'),
'name' => 'id_product',
'id' => 'product',
'options' => array(
'query' => $products,
'id' => 'id_product',
'name' => 'name'
)
),
// array(
//
'submit' => array(
'title' => $this->l('Save'),
'class' => 'button'
),
'cancel' => array(
'title' => $this->l('Cancel'),
'class' => 'button'
)
);
所以下拉字段應顯示基於第一個下拉選擇 任何想法,請分享。
您需要返回所呈現的助手之前添加一些JavaScript,或者創建一個管理模板,並把一些JS裏面來管理不同選擇的造型 –