Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2010
    Location
    New Jersey USA
    Posts
    81
    Thanks
    13
    Thanked 4 Times in 4 Posts

    Adding a JavaScript pop up confirmation before submitting.

    Hello All.

    Need help adding a “continue anyway” button on my JavaScript Pop up. Pretty much you have several radio buttons to choose if you check all the radio buttons and click submit, it goes to the next page. If not a Java pop up will say please check all radio buttons before hitting submit. Everything works fine except the continue anyway button. When the javascript validation pops up I want an ok button and a continue anyway. Does anyone know how to add the continue anyway button.. Below is my Java Script of everything but…..

    Code:
    function isChecked(radgrp)
    {
    var i = radgrp.length;
    do
    if (radgrp[--i].checked)
    return true;
    while (i);
    return false;
    }
    
    function validateTest(els)
    {
    var focus_me = null, msg = "";
    
    if (!isChecked(els.game1))
    {
    msg += " Game #1\n";
    focus_me = focus_me || els.game1[0];
    }
    
    if (!isChecked(els.game2))
    {
    msg += " Game #2\n";
    focus_me = focus_me || els.game2[0];
    }
    
    if (!isChecked(els.game3))
    {
    msg += " Game #3\n";
    focus_me = focus_me || els.game3[0];
    }
    
    if (!isChecked(els.game4))
    {
    msg += " Game #4\n";
    focus_me = focus_me || els.game4[0];
    }
    
    if (!isChecked(els.game5))
    {
    msg += " Game #5\n";
    focus_me = focus_me || els.game5[0];
    }
    
    if (!isChecked(els.game6))
    {
    msg += " Game #6\n";
    focus_me = focus_me || els.game6[0];
    }
    
    if (!isChecked(els.game7))
    {
    msg += " Game #7\n";
    focus_me = focus_me || els.game7[0];
    }
    
    if (!isChecked(els.game8))
    {
    msg += " Game #8\n";
    focus_me = focus_me || els.game8[0];
    }
    
    if (!isChecked(els.game9))
    {
    msg += " Game #9\n";
    focus_me = focus_me || els.game9[0];
    }
    
    if (!isChecked(els.game10))
    {
    msg += " Game #10\n";
    focus_me = focus_me || els.game10[0];
    }
    
    if (!isChecked(els.game11))
    {
    msg += " Game #11\n";
    focus_me = focus_me || els.game11[0];
    }
    
    if (!isChecked(els.game12))
    {
    msg += " Game #12\n";
    focus_me = focus_me || els.game12[0];
    }
    
    if (!isChecked(els.game13))
    {
    msg += " Game #13\n";
    focus_me = focus_me || els.game13[0];
    }
    
    if (!isChecked(els.game14))
    {
    msg += " Game #14\n";
    focus_me = focus_me || els.game14[0];
    }
    
    if (!isChecked(els.game15))
    {
    msg += " Game #15\n";
    focus_me = focus_me || els.game15[0];
    }
    
    if (!isChecked(els.game16))
    {
    msg += " Game #16\n";
    focus_me = focus_me || els.game16[0];
    }
    if (msg != "")
    {
    var prefix = "\nThe following Games(s) were not selected:\n\n";
    var suffix = "\nPlease correct and re-submit your picks.";
    alert(prefix + msg + suffix);
    if (focus_me)
    focus_me.focus();
    return false;
    }
    return true;
    }
    Thanks

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,159
    Thanks
    203
    Thanked 2,549 Times in 2,527 Posts
    Just change the alert into a confirm dialog:-

    Code:
    var prefix = "\nThe following Games(s) were not selected:\n\n";
    var suffix = "\nPlease click OK to correct and re-submit your picks.";
    var suffix = suffix + "\nor click CANCEL to continue anyway."
    var ask = confirm(prefix + msg + suffix);
    if (ask) {
    if (focus_me) {
    focus_me.focus()
    }
    return false;
    }
    else {
    return true;
    }

    "The only function of economic forecasting is to make astrology look respectable". - J.K.Galbraith

  • Users who have thanked Philip M for this post:

    connollyc4 (09-20-2010)


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •