Revision: 9813
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 24, 2008 00:56 by jimfred
Initial Code
<form name="FormRecuring" action="https://www.paypal.com/cgi-bin/webscr" method="post"> ... <script type="text/javascript"> // Validate dollar amount upon clicking Submit2. // if validation is successful, perform a 'submit' on the form. function SubmitRecuring() { // See if there's a leading '$'. if ( FormRecuring.a3.value[0]=="$" ) { var iLen = FormRecuring.a3.value.length; // Strip the leading char. FormRecuring.a3.value = String(FormRecuring.a3.value).substring(1); } var DollarAmount = parseFloat(FormRecuring.a3.value); // Convert to a float. DollarAmount = DollarAmount.toFixed(2); // keep 2 digits to the right of the decimal. // alert( DollarAmount ); if ( DollarAmount <= 0 || isNaN(DollarAmount) ) { alert( "Enter a dollar amount" ); return false; // return without submitting the form. } FormRecuring.submit(); // Submit the form. return true; } </script> <!-- Comment-out this input control; replace 'input' with 'img' and add 'onclick=' to call SubmitRecuring(). <!-- input ilo-full-src="http://images.paypal.com/images/x-click-but31.gif" name="submit" src="giving00_files/x-click-but31.gif" alt="Make payments with PayPal, it's fast, free, and secure!" border="0" type="image" width="72" height="32"--> <img onclick="SubmitRecuring()" ilo-full-src="http://images.paypal.com/images/x-click-but31.gif" name="Submit2" src="giving00_files/x-click-but31.gif" alt="Make payments with PayPal, it's fast, free, and secure!" border="0" type="image" width="72" height="32"> </form>
Initial URL
Initial Description
This demonstrates how to validate parameters prior to submitting a PayPal form
Initial Title
PayPal parameter validation
Initial Tags
Initial Language
JavaScript