Page 1 of 1

Backend buttons do not work

Posted: Sun Nov 25, 2007 3:19 pm
by delighted
Hi there,

Writing my first Joomla component everything is fine, exept for one little problem.

My toolbar buttons do not work...

Buttons are visible in the toolbar, I can click the buttons, but nothing happens. I opened lots of working components and everything looks the same.

Error-reporting is E_ALL, and I don't get any warning or error.

Who can help me??

toolbar.mycomp.php:

Code: Select all

<?php
error_reporting(E_ALL);

defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');

require_once($mainframe->getPath('toolbar_html'));

$act = mosGetParam( $_REQUEST, 'act', '' );
$task = mosGetParam( $_REQUEST, 'task', '' );


switch($act) {
    case 'config':
        switch ($task) {
            case 'save':
            default:
                TOOLBAR_mycomp::configButtons();
                break;
         }
         break;

    case 'manage':
        switch ($task) {
            case 'delete':
                TOOLBAR_mycomp::defaultButtons();
                break;
            case 'save':
                TOOLBAR_mycomp::defaultButtons();
                break;
            default:
                TOOLBAR_mycomp::defaultButtons();
                break;
        }
        break;
}

?>


toolbar.mycomp.html.php:

Code: Select all

<?php
error_reporting(E_ALL);

defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');

class TOOLBAR_mycomp {
    function defaultButtons() {
        mosMenuBar::startTable();
        mosMenuBar::addNew();
        mosMenuBar::deleteList();
        mosMenuBar::endTable();
    }

    function configButtons() {
        mosMenuBar::startTable();
        mosMenuBar::cancel();
        mosMenuBar::spacer();
        mosMenuBar::save();
        mosMenuBar::endTable();
    }
}
?>


admin.mycomp.php:

Code: Select all

<?php
error_reporting(E_ALL);

defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');

if (!($acl->acl_check('administration', 'edit', 'users', $my->usertype, 'components', 'all') || $acl->acl_check('administration', 'edit', 'users', $my->usertype, 'components', 'com_dailymessage'))) {
mosRedirect('index2.php', _NOT_AUTH);
}

require_once($mainframe->getPath('admin_html'));

$act = mosGetParam( $_REQUEST, 'act', '' );
$task = mosGetParam( $_REQUEST, 'task', '' );


switch($act) {
    case 'config':
        switch ($task) {
            case 'cancel':
                mosRedirect( 'index2.php' );
                break;

             case 'save':
                 echo 'Should be saving when script is ready...';

             default:
                 HTML_mycomp::displayConfigForm();
                 break;
        }
        break;

    case 'manage':
        switch ($task) {
            case 'add':
                HTML_mycomp::displayAddForm();
                break;

            case 'delete':
                HTML_mycomp::displayItemList();
                break;

            case 'save':
                HTML_mycomp::displayItemList();
                break;

            default:
                HTML_mycomp::displayItemList();
                break;
    }
    break;
}

?>


Re: Backend buttons do not work

Posted: Mon Nov 26, 2007 12:08 am
by THE_AI
IS display_errors turned to on in your php.ini ?

Re: Backend buttons do not work

Posted: Mon Nov 26, 2007 9:36 pm
by delighted
All PHP-errors should be visible, but still the buttons aren't ok.

Anyone who has a clue???

Re: Backend buttons do not work

Posted: Tue Nov 27, 2007 6:43 am
by manuman
have you added the JS to your html?

Re: Backend buttons do not work

Posted: Tue Nov 27, 2007 8:06 am
by delighted
manuman wrote:have you added the JS to your html?


JS? Do you hav an example?

Never seen any JS in other scripts...  :-\

Re: Backend buttons do not work

Posted: Tue Nov 27, 2007 3:05 pm
by manuman
Try this in your HTML..

Code: Select all

<script language="javascript" type="text/javascript">
   function submitbutton(pressbutton) {
      var form = document.adminForm;

             if (pressbutton == 'canceltemplate') {
             submitform( pressbutton );
             return;
          }
          submitform( pressbutton );

   }
</script>


You can add validations etc if you want.

Cheers
Shayne