Forums

SOLVED: Where to put Plaxo widget Java scripts ?

daduts 12 Aug, 2010
Greetings,

I'm a new user and have built a couple forms with Chronoforms. Thanks for a cool component.

I'm working on an "recommend this site" form where a user can send an email to his contacts.
http://www.40seats.com/dave

My client has requested I integrate a pretty slick Plaxo Address Book widget.
http://www.plaxo.com/api/widget

The widget requires the following code be placed in the <head>.

<script type="text/javascript" src="http://www.plaxo.com/css/m/js/util.js"></script>
<script type="text/javascript" src="http://www.plaxo.com/css/m/js/basic.js"></script>
<script type="text/javascript" src="http://www.plaxo.com/css/m/js/abc_launcher.js"></script>
<script type="text/javascript"><!--
function onABCommComplete() {
// OPTIONAL: do something here after the new data has been populated in your text area
}
//--></script>

How can I accomplish this in Chronoforms ?

Many thanks,

Dave
GreyHead 12 Aug, 2010
Hi Dave,

For testing purposes you can try that code directly in the Form HTML box. The JavaScript won't be in the head but will probably still work OK.

To put into the head use this code
<?php
if ( !$mainframe->isSite() ) { return; }
$doc =& JFactory::getDocument();
$doc->addScript('http://www.plaxo.com/css/m/js/util.js');
$doc->addScript('http://www.plaxo.com/css/m/js/basic.js');
$doc->addScript('http://www.plaxo.com/css/m/js/abc_launcher.js');
$script = "
function onABCommComplete() {
// OPTIONAL: do something here after the new data has been populated in your text area
}
";
$doc->addScriptDeclaration($script);
?>


Bob
daduts 12 Aug, 2010
Well done, Bob,

That did the trick.

Thanks for the quick reply.

Cheers,

Dave
This topic is locked and no more replies can be posted.