Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-19-2010, 08:32 PM   PM User | #1
connollyc4
New Coder

 
Join Date: Mar 2010
Location: New Jersey USA
Posts: 74
Thanks: 11
Thanked 4 Times in 4 Posts
connollyc4 is an unknown quantity at this point
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
connollyc4 is offline   Reply With Quote
Old 09-19-2010, 09:05 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,036
Thanks: 197
Thanked 2,411 Times in 2,389 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
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
Philip M is online now   Reply With Quote
Users who have thanked Philip M for this post:
connollyc4 (09-20-2010)
Reply

Bookmarks

Tags
confirmation, javascript, radio button, validation

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:36 PM.


Advertisement
Log in to turn off these ads.