I'm trying to upgrade from V5 to V7 but the custom code I've created that uses javascript to total amounts entered in the form doesn't work. That element appears as an empty form with the javascript code in text form. I als ocan't see how to add in a custom code element into the actions on the form.
Hi
Where do you write your javascript code?
Do you use a Javascript View or a HTML view?
Where do you write your javascript code?
Do you use a Javascript View or a HTML view?
In CFv5 I use a custom code module. When the old orm was transferred to CFv7 it appeared as a custom code form at first bu it then disappeared. I then tried using a php module.
I'm not sure what a javascript view is. The code is:
But I've just noticed that javascript doesn't work in the free version which I was using to check whether I wanted to upgrade. Very annoying!
I'm not sure what a javascript view is. The code is:
<?php
JHtml::_('jquery.framework');
?>
var j = jQuery.noConflict();
j(document).ready(function(jQ) {
jQ('#subs').click(calc);
jQ('#subs1').change(calc);
jQ('#subs2').change(calc);
jQ('#donation').change(calc);
jQ('#total').click(calc);
function calc() {
var sum, sum1, sum2, sub, don;
sub = 0;
don = 0;
sum = 0;
sub = jQ('input[name=subs]:checked').val();
if(sub === undefined){sub = 0;}
don = jQ('#donation').val().replace(/\$/g, '');
if(don === ''){don = 0;}
sum1 = parseInt(sub);
sum2 = parseInt(don);
sum = (sum1 + sum2);
jQ('#total').val(sum);
}
});
But I've just noticed that javascript doesn't work in the free version which I was using to check whether I wanted to upgrade. Very annoying!
I've just found the trial validation option and the javascript doesn't work. It just appears as code text on the top of the form. Any suggestions how I can make it work?
Hi
For Joomla, you have to use a Javascript Element in View Section/Custom Code/Javascript
If you use JQuery, yo can try to check Add Inside domready event.
For Joomla, you have to use a Javascript Element in View Section/Custom Code/Javascript
If you use JQuery, yo can try to check Add Inside domready event.
I now have a javascript element just befoere the submit button with the above code. Insidedomready is selected but the javascript isn't working. Are element names different with CF7?
I think that CF5 form are not fully compatible with CF7. Test with a new form including simple javascript like alert('OK'). This does work...
You need to login to be able to post a reply.