getElementByID is null

sebg 16 Aug, 2012
Hello,

I made a form with Chronoform on a new website. I add a few javascript in the code on a radio input. Select it displays some options.

When I try the form with the "Frontend View" link in the administrator, the form works (http://www.goffe.be/credoc/index.php/fr/?option=com_chronoforms&chronoform=traduction-fr).
But on the website, the javascript is not working (http://www.goffe.be/credoc/index.php/fr/services/traduction), and Firebug is displaying " getElementById("cf_container_10") is null".

Is there a javascript conflict ? Or any other problem ?
Thanks,
Seb
sebg 16 Aug, 2012
Many thanks GreyHead, but Firebug don't display errors... Do you have an idea why a 'getElementById' don't work ?
GreyHead 16 Aug, 2012
Hi Seb,

You wrote:

Firebug is displaying " getElementById("cf_container_10") is null".

most likely it's because you are using JQuery on the site.

Bob
sebg 16 Aug, 2012
I add 'document.' before the 'getElemantById' functions. Now, it is working with Firefox, but not with Chrome.
And when I desactivate Jquery, it is the smae result...

Thanks!
GreyHead 17 Aug, 2012
Hi Seb,

Please try this in a Load JS action
window.addEvent('domready', function() {
  $('demandeur_0').addEvent('click', function() {
    $('cf_container_10').setStyle('display, 'none');
    $('cf_container_39').setStyle('display', 'block');
  });
  $('demandeur_1').addEvent('click', function() {
    $('cf_container_10').setStyle('display, 'block');
    $('cf_container_39').setStyle('display', 'none');
  });
});

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