[Javascript] Credit card page, processing before it's ready

Tim Makins spindrift at oceanfree.net
Wed Sep 1 02:30:02 CDT 2004


----- Original Message ----- 
From: <coldfusion.developer at att.net>
To: <javascript at LaTech.edu>
Sent: Tuesday, August 31, 2004 3:49 PM
Subject: [Javascript] Credit card page, processing before it's ready


> Hi,
>
> I have this Javascript that checks the details of credit card
> submissions.  It does the alert when the error is present, but
> after I click ok and try to go and fix the error, the page processes
> to the submission page....

You could also disable the submit button until certain criteria are met -
see code below.
Tim in Ireland.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<title></title>
<meta content="text/html; charset=windows-1252" http-equiv=Content-Type>
</head>
<body>
<script language="javascript">
function f2()
 {
  if(document.f1.chk1.checked)
     document.f1.Accept.disabled=false;
  else
     document.f1.Accept.disabled=true;
 }
</script>
</head>
<body>
How to disable a submit button until a box is checked
<p>
<form name="f1" action='downloads.jsp' method="post">
<input type="checkbox" name="chk1" value="yes" onClick="f2()">
<b>I have read and agree to the terms and conditions of use</b>
<p>
<input type="submit" name="Accept" value="Accept" disabled="true">
</form>
</body>
</html>




More information about the Javascript mailing list