homepage Welcome to WebmasterWorld Guest from 54.197.110.151
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
check box to pop up page
JuicyScript

5+ Year Member



 
Msg#: 4080857 posted 11:22 pm on Feb 15, 2010 (gmt 0)

I want a script to check if a form's check box is checked before it pops up a page
How will in combine this two scripts.
<script LANGUAGE="JavaScript">
<!--
function ValidateForm(form){
ErrorText= "";
if ( form.agree.checked == false ) { alert ( "Please check the Terms & Conditions box." ); return false; }
if (ErrorText= "") { form.submit() }
}
-->
</script>

<script>
//pop-up window for preview
function popup() {
win = window.open('','myWin','width=578,height=204,scrollbars=yes,resizeable=yes');
document.post.action='div.php';
document.post.target='myWin';
document.post.submit();
document.post.action='default.php';
document.post.target='_self';

}
</script>

 

jo3y



 
Msg#: 4080857 posted 11:36 pm on Feb 15, 2010 (gmt 0)

On a basic level:

The
onClick="validateForm()" call will need to be in the html most likely with an <input type="button" value="submit" onClick="validateForm()" >.

Then in the validateForm() function your test needs to use the if/else conditional.

function validateForm()
{
if (form.agree.checked == false)
{
alert( "Please check the Terms & Conditions box." );
}
else
{
popup();
}
}


Something along those lines.

JuicyScript

5+ Year Member



 
Msg#: 4080857 posted 10:15 pm on Feb 16, 2010 (gmt 0)

Can u help me with this?
<body>
<script LANGUAGE="JavaScript">
<!--
function validateForm();
{
if (form.agree.checked == false)
{
alert( "Please check the Terms & Conditions box." );
}
else
{
popup();
win = window.open('','myWin','width=578,height=204,scrollbars=yes,resizeable=yes');
document.post.action='div.php';
document.post.target='myWin';
document.post.submit();
document.post.action='default.php';
document.post.target='_self';
}
}



</script>
<div align="center">
<table width="860" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="137" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="860" height="137"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td height="37" colspan="2" valign="top"><table width="99%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="204" height="37"><div align="center"><img src="images/icons/home.png" tppabs="http://web.knust.edu.gh/registrationidl/images/icons/home.png" alt="home" width="20" height="20" border="0" align="absmiddle" /> <a href="index.php" tppabs="http://web.knust.edu.gh/registrationidl/index.php">Home</a></div></td>
<td width="183"><div align="center"></div></td>
<td width="210"><div align="center"></div></td>
<td width="254"><div align="center"></div></td>
</tr>
</table></td>
</tr>
<tr>
<td width="109" height="380">&nbsp;</td>
<td width="751" valign="top"><table width="100%" align="left" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="608" height="44" align="left" valign="top" bgcolor="#1A3A79"><img src="images/h1_bg.gif" width="7" height="7" align="top" />
<table width="709" height="29" border="0">
<tr>
<td><h1><span class="style1">New Online Form Application - Before you apply</span></h1></td>
</tr>
</table></td>
</tr>
<tr bordercolor="#1A3A79">
<td height="336"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<!-- @page { margin: 0.79in } H3 { margin-top: 0.14in; margin-bottom: 0in; color: #4f81bd } H3.western { font-family: "Cambria", serif; font-size: 12pt } H3.cjk { font-family: "Lucida Sans Unicode"; font-size: 12pt } H3.ctl { font-family: ; font-size: 12pt } P { margin-bottom: 0.08in } -->
<BODY DIR="LTR">
<p align="left">&nbsp;</p>
<p align="left"><strong>NOTE</strong></p>
<p align="left">Application to Health Training Institution</p>
<p align="left">All data held will be treated as confidential and will only be processed for purposes connected with your studies, or your health and safety while on any of our school’s premises, or for other legitimate reasons such as the compilation of statistics by Ghana government bodies and other authorized groups. </p>
<h3 align="left">PLEASE NOTE</h3>
<p align="left">(ii)You will be prosecuted for any forged or false declaration</p>
<ol type="i" start="3"><li><p align="left"><strong>Read the Guidelines <span class="err">CAREFULLY</span> </strong><strong>before filling the form. Click here for guidelines</strong></p>
</li>
<li>
<p align="left">Entry requirements are indicated in the Guidelines</p>
</li>
<li>
<p align="left">Study the West African Examination Council equivalents of Grades (WASSCE/SSSCE) <span class="err"><strong>CAREFULLY </strong></span>before filling the form. The equivalents are enclosed.</p>
</li>
<li>
<p align="left">Mode of payment of application fees is also indicated in the Guidelines</p>
</li>
</ol>
<h3 align="left"></h3>
<h3 align="left"></h3>
<h3 align="left">How to complete your application</h3>
<div align="left"></div>
<ul><li><p align="left"> Complete Steps 1 to 3 (each new step will appear after completion of the previous step).</p>
</li>
<li>
<p align="left"> Not all fields on the application form are mandatory, but please supply as much information as possible as this will be used by us in making a decision.</p>
</li>
<li>
<p align="left"> At the end of each step you will be shown a preview of the information you entered.</p>
</li>
<li>
<p align="left"> If the information contains any errors please go back and change it.</p>
</li>
<li>
<p align="left"> You should save your application on confirming that the information entered is correct. </p>
</li>
<li>
<p align="left"> Please note that after the final submission in step 3 you WILL NOT BE ABLE to change the information you have provided</p>
</li>
<li>
<p align="left"> After completion of step 3 you will be shown all the details you have entered.</p>
</li>
<li>
<p align="left"> Please print this page and fill out the declaration and endorsement portions.</p>
</li>
<li>
<div align="left"> You are required to submit this signed printout to the school if you are invited for interview</div>
</li>
</ul>
<p class="err"><strong>Please note you must not spend more than 30 minutes on a single page, or you will be automatically logged out.</strong></p>
<form id="post" name="post" method="post" action="default.php">
<div align="left">
<input type=hidden name=todo value=post>
<input type="checkbox" name="agree" value='yes' id="checkbox" />
<strong>PLEASE READ THE ABOVE INFORMATION AND RELEVANT GUIDE NOTES </strong>

</div>
<p>&nbsp;</p>
<table width="748" height="49" border="0">
<tr>
<td><div align="right">
<input type=submit class="FormInput2" value= "Continue >" onClick="validateForm()" >
</div></td>
</tr>
</form>

<p>&nbsp; </p></td>
</tr>
</table></td>
</tr>
<tr>
<td height="330">&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</div>
</body>
</html>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved