Skip to content Skip to sidebar Skip to footer

Javascript Alert Shows Up Twice

I am trying to use a module called disclaimer in Drupal 7 but the Alert 'You must enter the year you were born in.' Shows up twice and then proceeds to redirect to the URL you are

Solution 1:

Because you're returning alert. That will show the alert twice and because you aren't returning false, will make it continue to the next page.

Try this:

if (optyear == year) {
    alert(Drupal.t("You must enter the year you were born in."));
    returnfalse;
}

Solution 2:

The return alert is not neccessary.

alert(Drupal.t("You must enter the year you were born in."));
//return alert;

The alert will be fired by just using alert();

Post a Comment for "Javascript Alert Shows Up Twice"