2017-02-16 16 views
0

Prestashop backoffice에서 "저장"이라는 레이블이 지정된 제출 단추가있는 양식을 만들었습니다. 다른 작업과 함께 다른 제출 단추를 추가 할 수 있습니까?하나의 양식에 두 개의 제출 버튼이있을 수 있습니까?

+0

http://stackoverflow.com/questions/16162972/more-than-one-submit-button [하나가 제출 한 것보다 더 많은 버튼] (의 –

+0

가능한 중복 http://stackoverflow.com/questions/16162972/more-than-submit-button) –

답변

0

필요한 것을 수행하려면 동일한 작업 도우미에 여러 작업을 바인드하지 말고 도우미에 대해 정의 된 각 제출 입력 유형마다 다른 이름을 지정하면 안됩니다.

0

그냥 당신이 당신이 볼 정도로, 당신은

<button type="{if isset($btn['type'])}{$btn['type']}{else}button{/if}"... 

wehere 유형이 '제출'할 수있는 사용자 정의 버튼의 배열을 정의 할 수있는 부품

{if isset($fieldset['form']['buttons'])} 
    {foreach from=$fieldset['form']['buttons'] item=btn key=k} 
    {if isset($btn.href) && trim($btn.href) != ''} 
     <a href="{$btn.href}" {if isset($btn['id'])}id="{$btn['id']}"{/if} class="btn btn-default{if isset($btn['class'])} {$btn['class']}{/if}" {if isset($btn.js) && $btn.js} onclick="{$btn.js}"{/if}>{if isset($btn['icon'])}<i class="{$btn['icon']}" ></i> {/if}{$btn.title}</a> 
    {else} 
     <button type="{if isset($btn['type'])}{$btn['type']}{else}button{/if}" {if isset($btn['id'])}id="{$btn['id']}"{/if} class="btn btn-default{if isset($btn['class'])} {$btn['class']}{/if}" name="{if isset($btn['name'])}{$btn['name']}{else}submitOptions{$table}{/if}"{if isset($btn.js) && $btn.js} onclick="{$btn.js}"{/if}>{if isset($btn['icon'])}<i class="{$btn['icon']}" ></i> {/if}{$btn.title}</button> 
    {/if} 
    {/foreach} 
{/if} 

를 찾을 수있다 admin/themes/default/template/helpers/form/form.tpl 검사 귀하의 버튼에 대한 '이름'이 정의 된 경우, postProcess()에서 추가 양식 입력 버튼을 채울 수 있습니다.

f.e.

public function renderForm() { 

    $default_lang = (int)Configuration::get('PS_LANG_DEFAULT'); 
    $fields_form = array(); 

    $fields_form[0]['form'] = array(
     'legend' => array(
      ... legend part... 
     ), 
     'input' => array(
      ...arrays of inputs... 
     ), 
     'submit' => array(
      ...default submit button... 
     ), 
     'buttons' => array(
      '0' => array(
       'type' => 'submit', 
       'title' => $this->l('Whatever'), 
       'name' => 'MySubmitName', 
       'icon' => 'process-icon-back', 
       'class' => 'pull-right', 
      ) 
     ) 
    ); 

    $helper = new HelperForm(); 

    // Module, token and currentIndex 
    $helper->token = Tools::getAdminTokenLite('AdminYourClassName'); 
    $helper->currentIndex = self::$currentIndex; 

    // Language 
    $helper->default_form_language = $default_lang; 
    $helper->allow_employee_form_lang = $default_lang; 

    // Title and toolbar 
    $helper->show_toolbar = false; 

    $helper->submit_action = 'submitWhatever'; 

    return $helper->generateForm($fields_form); 

}