Forums

Confused over javascript and template issue

Philip Roy 22 Jun, 2008
Hi there,

I think I'm repeating an issue that is discussed elsewhere but I don't quite understand what the solution is.

I just launched a new site and in two areas I have an issue with the template, or more specifically the login module. One if the Fireboard forum area and the other is on this page...

http://www.nziphone.com/contact.html

The problem is that the login area should be hidden at the top but isn't. It seems (from reading on this site) that it is related to the mambot/plugin and with validation....I also read something about doing away with using the plugin...but I'm not sure where to start.

I had help from this forum setting up the form (it's a copy of one on my NZMac.com website) and the HTML code in the back contain javascript also. I think the whole thing is based on this...
http://www.chronoengine.com/content/view/31/39/

...but I don't quite understand where to start, what to stop using, how to make changes etc.

Cheers,

Phil
Philip Roy 11 Jul, 2008
Still stuck...and the Joomla 1.5.4 update hasn't resolved any issues. Would really like the login menu to be consistent (and hidden) when not needed.

Phil
GreyHead 11 Jul, 2008
Hi Philip,

Sorry I missed your post the first time around. There certainly is a problem as ChronoForms seems to be loading both the Mootools and the Proptotype libraries. Joomla is also loading the mootools library.

I wonder if you have an old version of the ChronoForms Mambot/PlugIn that doesn't recognise the 'Use Mootools' parameter. I can't think what else would cause this . . .

Bob

Philip Roy 11 Jul, 2008
Hi,

Thanks for your comments. I have 0.6 of the pro version of the plugin that was emailed to me installed. I just uninstalled and reinstalled it to be sure. Strangely it lists itself as version 0.5 within Joomla, but I'm fairly sure I'm up to date.

Phil
GreyHead 11 Jul, 2008
Hi Phil,

I have a version dated November that is also labelled 0.5 - It doesn't seem to have the code to load the MooTools library - please can you check yours around line 155. Thanks

Bob
Philip Roy 11 Jul, 2008
I have no idea where and what I'm meant to be looking for sorry.

Will have to check tomorrow. Night.

Phil
Philip Roy 13 Jul, 2008
Hi there,

Just to come back to this. I've opened every file I can think of, but I'm really not sure where I am meant to be looking.

Cheers,

Phil
GreyHead 18 Jul, 2008
Hi Phil,

Sorry, I've been away for a few days. The file is {root}/plugins/content/chronocontact.php In the version I have there is a locl of code starting on line 153 like this
        if ( trim( $paramsvalues->validate ) == 'Yes' ) {
?>
<script src="components/com_chronocontact/js/prototype.js"
	type="text/javascript"></script>
<script src="components/com_chronocontact/js/effects.js"
	type="text/javascript"></script>
<script src="components/com_chronocontact/js/validation.js"
	type="text/javascript"></script>
<?php
        }
Whilst the equivalent code in {root}/components/com_chronocontact/chronocontact.html.php around line 35 is
            if ( trim( $paramsvalues->validate ) == 'Yes' ) {
                if ( trim( $paramsvalues->validatetype ) == 'prototype' ) {
?>
<script src="components/com_chronocontact/js/prototype.js"
	type="text/javascript"></script>
<script src="components/com_chronocontact/js/effects.js"
	type="text/javascript"></script>
<script src="components/com_chronocontact/js/validation.js"
	type="text/javascript"></script>
<?php
                }
                if ( trim( $paramsvalues->validatetype ) == 'mootools' ) {
?>
<script src="components/com_chronocontact/js/mootools-release-1.11.js"
	type="text/javascript"></script>
<script src="components/com_chronocontact/js/mooValidation.js"
	type="text/javascript"></script>
<?php
                }
            }
it includes the extra 'if' clause that inserts mootools or prototype.

I'm not sure if this difference is in your code or not - mine may be an old version of the plugin.

Bob
Philip Roy 18 Jul, 2008
Hi there and thanks for your post.

I have exactly the same code (ie, mootools is mentioned) in both files, not just one. So both files have code similar to your second set of code in your post rather than the first.

This is all a bit beyond me..I'm not sure what we are checking.....but just to ask? For validation of my forms, I had it set to "prototype" once but now have it set to "mootools"...not sure if that is relevant but thought I would mention it.

Phil
GreyHead 18 Jul, 2008
Hi Phil,

Thanks for checking. If you go back to my post #10236 in this thread you'll see that it looks as though ChronoForms is loading both the MooTools and the Prototype JavaScript libraries. This shouldn't happen - having both libraries loaded seems almost inevitably to lead to JavaScript conflicts and browser problems.

I went down a blind alley in thinking that this might be a problem with the PlugIn/mambot code but it doesn't seem to be so.

Bob
Philip Roy 18 Jul, 2008
Hmmm...OK, thanks for trying to come up with a solution. Not really sure what to do now.

Phil
GreyHead 18 Jul, 2008
Hi Phil,

Right now I'm catching up after being away for a few days, when I have some free time I'll take another look and see if I can work out what is happening here.

Bob
Philip Roy 22 Jul, 2008
Hi there,

Well in trying to build a registration page (still can't get it to compare two passwords without a 500 page error) I've found that the issue for this thread seems to be with the Form HTML code that starts...

<?php
global $mosConfig_live_site;
$folder = $mosConfig_live_site.'/components/com_chronocontact/js';
echo "<script src='$folder/prototype.js' type='text/javascript'></script><br />";
echo "<script src='$folder/validation.js' type='text/javascript'></script>";
?> 


If I remove this code then the page display properly, but I suspect the code about is important?? Not sure what it does, but it was suggested to use ages ago when developing my first chronoform.

Phil
Philip Roy 22 Jul, 2008
OK, well I'm completely confused...but very pleased. Even when I take that code out, the contact form works perfectly and the issue of the login menu that was meant to stay hidden goes away?

The code was from this great post . . . so it had something to do with validation. But even on removing it, the form is validating properly....so I don't know what I did...but all is good.

Now to work on my registration page issue. Bob, thanks for your help in trying to solve the issue.

Cheers,

Phil
GreyHead 22 Jul, 2008
Hi Phil,

That chunk of code loads the Prototype JavaScript library. The thread you picked up was from the first time that that validation method was tried with ChronoForms. Since then Max has built it into the core code and this snippet is no longer needed - indeed it caused you some problems.

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