• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Problems with Java script after update!

Problems with Java script after update! 9 years 5 months ago #33757

  • Pelle P
  • Pelle P's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
After the latest update this java script, has stopped working:

The script is very important for me!

Can you please help?

<script type="text/javascript">

window.addEvent('domready', function() {

if (document.getElementsByName('form[cpr]')[0].addEventListener) {
document.getElementsByName('form[cpr]')[0].addEventListener("blur", function () {
validateCpr();
}, false);
}else{
document.getElementsByName('form[cpr]')[0].attachEvent("onblur", function () {
validateCpr();
});
}

});

function validateCpr()
{
if (_calcAgeFromCpr(document.getElementsByName('form[cpr]')[0].value) > 29) {
document.getElementsByName('form[alderDropDown][]')[0].value = "Over 30";
document.getElementsByName('form[alderDropDown][]')[0].click();
} else {
document.getElementsByName('form[alderDropDown][]')[0].value = "Under 30";
document.getElementsByName('form[alderDropDown][]')[0].click();
}
}
function _calcAgeFromCpr(cpr) {
if(cpr.match(/^[0-9]{6}\-?[0-9]{4}$/)) {
var day = cpr.substring(0,2);
var month = cpr.substring(2,4);
var year = cpr.substring(4,6);
var bday = new Date(year, month - 1, day);
return _calculateAge(bday);
} else {
return false;
}
}
function _calculateAge(birthday) { // birthday is a date
var ageDifMs = Date.now() - birthday.getTime();
var ageDate = new Date(ageDifMs); // miliseconds from epoch
return Math.abs(ageDate.getUTCFullYear() - 1970);
}
</script>
The administrator has disabled public write access.

Problems with Java script after update! 9 years 5 months ago #33758

  • Pelle P
  • Pelle P's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Is it possible to down grade?

The problem is on a live site!
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!