Backend buttons do not work

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
delighted
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Sun Nov 25, 2007 2:26 pm

Backend buttons do not work

Post by delighted » Sun Nov 25, 2007 3:19 pm

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;
}

?>


User avatar
THE_AI
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Sat Jun 03, 2006 4:33 pm
Contact:

Re: Backend buttons do not work

Post by THE_AI » Mon Nov 26, 2007 12:08 am

IS display_errors turned to on in your php.ini ?
Well, now I will try to develop extensions :)

delighted
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Sun Nov 25, 2007 2:26 pm

Re: Backend buttons do not work

Post by delighted » Mon Nov 26, 2007 9:36 pm

All PHP-errors should be visible, but still the buttons aren't ok.

Anyone who has a clue???

User avatar
manuman
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 211
Joined: Fri Aug 12, 2005 1:58 am
Location: Albany - Western Australia
Contact:

Re: Backend buttons do not work

Post by manuman » Tue Nov 27, 2007 6:43 am

have you added the JS to your html?
Core Team Member :: Project Manager & Foundation WG Coordinator
OSM Board Member :: Treasurer
Vote for Joomla! http://www.packtpub.com/nominations-homepage

delighted
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Sun Nov 25, 2007 2:26 pm

Re: Backend buttons do not work

Post by delighted » Tue Nov 27, 2007 8:06 am

manuman wrote:have you added the JS to your html?


JS? Do you hav an example?

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

User avatar
manuman
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 211
Joined: Fri Aug 12, 2005 1:58 am
Location: Albany - Western Australia
Contact:

Re: Backend buttons do not work

Post by manuman » Tue Nov 27, 2007 3:05 pm

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
Core Team Member :: Project Manager & Foundation WG Coordinator
OSM Board Member :: Treasurer
Vote for Joomla! http://www.packtpub.com/nominations-homepage


Post Reply