2014-02-10 39 views
1

標準的管理工具欄按鈕有可能給你一條消息。例如:一個「真正刪除」的消息或...Joomla自定義工具欄按鈕消息

JToolBarHelper::deleteList('Do you wanna really delete?', 'controller.delete'); 

這也是可能的自定義按鈕?在文檔中沒有這個參數。 http://docs.joomla.org/JToolBarHelper/custom

Joomla有其他解決方案嗎?向用戶顯示一條消息,並在他確認後執行我的代碼!那可能嗎?

對不起,我的英語不好:) 謝謝!

+0

你可以ASLO看看全新的Joomla堆棧交換場地位置:http://joomla.stackexchange.com/ –

回答

5

當然有可能:)

只需添加到您的組件模板視圖(例如:)

administrator/components/com_yourcomponent/views/your_view/tmpl/default.php 

驗證碼:

<script type="text/javascript"> 
    Joomla.submitbutton = function(task) 
    { 
     if (task == 'customcontroller.delete') 
     { 
      if (confirm(Joomla.JText._('Do you really want to delete these items?'))) { 
       Joomla.submitform(task); 
      } else { 
       return false; 
      } 
     } 
    } 
</script> 

只需更改任務和編輯消息,你應該準備好去

+0

感謝WellBloud :) – user3033136

+0

非常感謝WellBloud。它節省了我的時間。 – ChintanThummar

1

添加此代碼到這個URL: 管理員/組件/ com_yourcomponent /視圖/ your_view/TMPL /如default.php

<script type="text/javascript"> 
Joomla.submitbutton = function(task) 
{ 
    if (task == 'customcontroller.delete') 
    { 
     if (confirm('Do you really want to delete these items?')== true) 
     { 
      Joomla.submitform(task); 
     } 
     else { 
      return false; 
     } 
    } 
    else 
    { 
     Joomla.submitform(task); 
    } 
} 
</script>