Buy Now
Sign in

Using javascript in Wordpress Chronoforms5

cappleby , October 27 2017
I've moved a form from Joomla to Wordpress but I get the following Fatal Error:
Uncaught Error: Class 'JHtml' not found in /home/anglicanfuture/ : eval()'d code:2 Stack trace: #0
The form is at
Is there something I can add to Chronoforms5 or the Wordpress site to allow javascript to work in Wordpress?
Hi cappleby,

The problem is in Line 2 of some Custom Code you have in the form. You'll need to check that and make sure that is WordPress compatible.

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
Thanks. In case others are trying to do the same thing, the Joomla version of the form has a java script element that uses a call to the Joomla library:
But that doesn't work in Wordpress.
Instead I needed to de-register the WP version of jquery then enqueue a new version of jQuery:
// include custom jQuery
function shapeSpace_include_custom_jquery() {
  wp_enqueue_script('jquery', '', array(), null, true);
add_action('wp_enqueue_scripts', 'shapeSpace_include_custom_jquery');

jQuery(document).ready(function(jQ) {
jQ('#Fees').click(calc); ... etc.

I found this at

Chris A
Further to my post, if you want to run two java scripts for some reason (which I did) the deregister and enqueue_script aren't necessary (and will give an error) so the second time you only need to begin with
​// include custom jQuery​
​add_action('wp_enqueue_scripts', ​
Of course it may be possible to include both scripts in the one java box but I haven't tried that as yet.
Chris A