Forums

JavaScript Use (Not Validation)

UpRaiser 17 Sep, 2008
Hi,

I have been searching this forum, and found many JS related topics. Non were dealing with my problem, so I'll try to explain:
(The form is in hebrew language, but the funcionality is important here... try to overcome the encoding issue)

I want to implement this form into ChronoForms:
http://www.hedmusic.co.il/form/form.html

This form calls behaviour.js file, which makes the Dropdown function. It's not Validation - Just applying different part of form for each Dropdown selection.

In Chronoforms, I took the HTML part (w.out the tags) and pasted it in place. Same with the behaviour.js content. The result was that all form parts, regardless with the dropdown selection - are displayed one after another. This means that the JS isn't working.

I guess that there should be a correct JS call in the Form tag attachment, but I tried several things, with no success.

if this help, this is the Form implementation, in ChronoForms (again, Hebrew):
http://www.hedmusic.co.il/index.php?option=com_content&view=article&id=78&Itemid=81

Thanks in Advance,

Nir.
Max_admin 17 Sep, 2008
Hi,

maybe you will need to add the JS include line in the form code box, this line :

<script src="behaviour.js" type="text/javascript"></script>
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
UpRaiser 17 Sep, 2008
Hi Admin,

Thanks for the reply.

Usually, the JS tags come before the <form> tag... if i'll put it inside the form code box (you ment he HTML one ? The JS doesn't get the script tags...) - its like inserting it inside.. which doesn't seems as a correct synatx or logic.

Tried to implement it, with no success.
UpRaiser 17 Sep, 2008
tried to call the script file this way also:

<?php
global $mosConfig_live_site;
$folder = $mosConfig_live_site.'/form';
echo "<script src='$form/behaviour.js' type='text/javascript'></script>";
?>


or even call the JS file from the template... No success....
Max_admin 17 Sep, 2008
Hi,

if you have Joomla 1.5, look at this example how it inserts the JS file at the page header, you can add the same code to the form HTML box and the script will get inserted in the page header.

$document =& JFactory::getDocument();
	$document->addScript(JURI::Base().'components/com_chronocomments/msg.js');


Regards

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
UpRaiser 18 Sep, 2008
Hi Max,

I think something is missing with the code you're showing here... Tried to insert in the HTML code - it doesn't work, and shows the text in the front-end.

Tried to insert it between the <head> Tags in the Template... no help.😟
GreyHead 18 Sep, 2008
Hi UpRaiser,

The code should go in the Form HTML inside php tags ( I think that Base may need to be base too).
<?php
$document =& JFactory::getDocument();
$document->addScript(JURI::base().'components/com_chronocomments/msg.js');
?>


Bob

PS Just for completeness you can use similar code to add a stylesheet
<?php
$document =& JFactory::getDocument();
$document->addStyleSheet(JURI::base().'components/com_chronocomments/my.css');
?>
Change the path to suit.
UpRaiser 24 Sep, 2008
Thanks GreyHead,

But still ain't working..😶 . I've inserted your code (with "base") and changed the path to the correct one, leading to the js. file.

<?php
$document =& JFactory::getDocument();
   $document->addScript(JURI::base().'form/behaviour.js');
?>


could there be any conflict, even though no JS or Ajax module is used ?
Max_admin 24 Sep, 2008
Hi, try with base and Base and check the file is loaded before you think about js conflicts since this is another issue!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.