/    Sign up×
Community /Pin to ProfileBookmark

can javascript do this…

What i have is a page with a form on it i want the form instead of going to the verify page to run the script and inside my script which i have i want it to if its ok go to the verify page and if its not pup up and say what is wrong.. attached is my code..

[CODE]<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″ />
<title>Illinois Soybean Association Rust Watchers</title>
<meta name=”description” content=”” />
<meta name=”keywords” content=”” />
<link href=”../../../../_lib/global.css” rel=”stylesheet” type=”text/css” media=”screen” />
<link href=”../../../../_lib/selectors.css” rel=”stylesheet” type=”text/css” media=”screen” />

</head>

<body>
<!– HEADER –>
<?php require(“../../../../_inc/header.php”); ?>
<!– END OF HEADER –>
<div id=”body”>
<div id=”left”>
<div id=”navContainer”>
<ul id=”nav”>
<li class=”select”><a href=”/about/”>ABOUT</a></li>
<li>
<ul>
<li><a href=”/about/research/”>Research</a></li>
<li><a href=”/about/legislature/”>Legislature</a></li>
<li><a href=”/about/international-marketing/”>International Marketing</a></li>
<li class=”select”><a href=”/about/programs/index.php”>Programs</a></li>
</ul>
</li>
<li><a href=”/membership/”>MEMBERSHIP</a></li>
<li><a href=”/soybean-uses/”>SOYBEAN USES</a></li>
<li><a href=”/education/”>EDUCATION</a></li>
<li><a href=”/soy-news/”>SOY NEWS</a></li>
<li><a href=”/resources/”>RESOURCES</a></li>
<li><a href=”/directors/”>DIRECTORS</a></li>
<li><a href=”/contact/”>CONTACT</a></li>
</ul>
</div>
<div id=”navBg”></div>
</div>
<div id=”content”>
<div id=”center”>
<p id=”breadcrumbs”><a href=”/”>Home</a> &raquo; <a href=”/about/”>About</a> &raquo; <a href=”/about/programs”>Programs</a> &raquo; <a href=”/about/programs/rust-watchers/”>Rust Watchers</a> &raquo; <a href=”index.php” class=”select”>Application</a></p>
<h2>Soybean Rust Watcher Sign-Up</h2>
<img src=”../../../../_img/defendYourYieldslogo.jpg” vspace=”5″ hspace=”5″ height=”100″ width=”100″ align=”middle” />

<FORM Method=”Post” Action=”verify.php” id=form2 name=”SignUpForm” onsubmit=”contactCheck()”>
<table>
<tr>
<td>Name:</td>
<td><input type=”text” name=”fieldname”></td>
</tr>
<tr>
<td>Address:</td>
<td><input type=”text” name=”fieldaddress”></td>
</tr>
<tr>
<td>City:</td>
<td><input type=”text” name=”fieldcity”></td>
</tr>
<tr>
<td>State:</td>
<td><input type=”text” name=”fieldstate”></td>
</tr>
<tr>
<td>Zip Code:</td>
<td><input type=”text” name=”fieldzip”></td>
</tr>
<tr>
<td>Phone:</td>
<td><input type=”text” name=”fieldphone”></td>
</tr>
<tr>
<td>Fax:</td>
<td><input type=”text” name=”fieldfax”></td>
</tr>
<tr>
<td>E-Mail:</td>
<td><input type=”text” name=”fieldemail”></td>
</tr>
<tr>
<td></td>
<td>

<Input Type=”Submit” Name=”button” Value=”Submit Application” onclick=”contactCheck();”>
</td>
</tr>
</table>
</form>
</div>
<div id=”right”>
<div class=”blue”>
<h4>Program Sections</h4>
<ul>
<li><a href=”/about/programs/soybean-quality/”>The Soybean Quality Rewards Program</a></li>
<li><a href=”/about/programs/rust-watchers/”>Rust Watchers</a></li>
<li><a href=”/about/programs/soyleaders/”>SoyLeaders</a></li>
<li><a href=”/about/programs/speakers-bureau/”>Speakers Bureau</a></li>
</ul>
</div>
</div>
<br clear=”both” />
<!– FOOTER –>
<?php require(“../../../../_inc/footer.php”); ?>
<!– END OF FOOTER –>
</div>
</div>
</body>
</html>

[/CODE]

i’m new to js and have no idea if it can be done or how it is done if it can be done…

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@konithomimoAug 11.2006 — change this:

onsubmit="contactCheck()"

to this:

onsubmit="return contactCheck()"

and just have contactCheck() return true or false. If it is false then the form will not submit, but if it returns true then the form submits.
×

Success!

Help @Codeman0013 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...