[TYPO3-dev] Ajax/JS help needed.

Stig Nørgaard Færch stig at 8620.dk
Mon Jul 28 09:26:13 CEST 2008


I'm trying to create a new version of the Roles extension which is 
compatible with 4.2 and up.

I have based the new Roles menu on the new shortcutmenu. I have almost 
got it working, but I have one problem which is bugging me still.

I use this:
new Ajax.Updater('typo3-menu', TS.PATH_typo3 + 'ajax.php', {
         parameters   : 'ajaxID=ModuleMenu::render',
         asynchronous : false,
         evalScripts  : true,
         onComplete : eval(shortcut)

});
to refresh the ModuleMenu after a role has been activated.
This should also refresh the javascript function used to switch modules
so that it's possible to actually possible to access new menuitems.
The ModuleMenu seems to be refreshed fine, as I can activate new modules 
which appears when I activate a Role.

But then on to my problem. The onComplete part gives me some problems. 
To every role, it's possible to assign a shortcut from the shortcut 
menu. So I can have a link in the menu which should both activate a role 
and activate a shortcut. I got:
onComplete : eval(shortcut)
shortcut is a var which contains the javascript to activate the 
shortcut. But it doesn't work the first time I click at role+shortcut 
link. But it works the next time I click the same link.
So it seems like that updated javascript in the ModuleMenu is not ready 
somehow in the same "instance". Any ideas how to solve this one??

Thanks in advance!

/Stig




More information about the TYPO3-dev mailing list