Bug 1442 - Friend Program Improvements
Signed-off-by: Edouard Poitras <edouard@eclipse.org>
diff --git a/content/en_index.php b/content/en_index.php
index 38937ae..3473ec8 100644
--- a/content/en_index.php
+++ b/content/en_index.php
@@ -144,7 +144,7 @@
</div>
<div id="custom-donation" class="row">
<div class="col-md-24">
- <form action="<?php print $paypal_url; ?>" method="POST">
+ <form action="<?php print $paypal_url; ?>" method="POST" onsubmit="return validate_amount();">
<input type="hidden" name="business" value="<?php print $donation_email; ?>"/>
<input type="hidden" name="item_name" value="Donation"/>
<input type="hidden" name="no_shipping" value="1"/>
diff --git a/donation.js b/donation.js
new file mode 100644
index 0000000..357dc24
--- /dev/null
+++ b/donation.js
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Eclipse Foundation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Edouard Poitras (Eclipse Foundation) - Initial Implementation
+ *******************************************************************************/
+function validate_amount() {
+ var amount = document.getElementById('donation-amount').value
+ if (isNaN(amount) || amount < 1) {
+ alert("You must specify an amount higher than $1");
+ return false;
+ }
+ return true;
+}
diff --git a/index.php b/index.php
index 6668e75..112eead 100644
--- a/index.php
+++ b/index.php
@@ -31,5 +31,6 @@
$html = ob_get_clean();
# Generate the web page
+$App->AddExtraHtmlHeader('<script type="text/javascript" src="/donate/donation.js"></script>');
$App->AddExtraHtmlHeader('<link rel="stylesheet" type="text/css" href="style.css" media="screen" />');
$App->generatePage("solstice", $Menu, NULL, $pageAuthor, $pageKeywords, $pageTitle, $html);