Skip to content
Snippets Groups Projects
Commit b0cf1474 authored by Eric Rasmussen's avatar Eric Rasmussen
Browse files

Validate required fields

parent 9afd1a50
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,22 @@ if (file_exists(dirname(__FILE__).'/../../../config-landscape-outdoorevents.inc. ...@@ -5,6 +5,22 @@ if (file_exists(dirname(__FILE__).'/../../../config-landscape-outdoorevents.inc.
require_once dirname(__FILE__).'/../../../config-landscape-outdoorevents.sample.php'; require_once dirname(__FILE__).'/../../../config-landscape-outdoorevents.sample.php';
} }
if (!empty($_POST)) { if (!empty($_POST)) {
$error_msg = '';
if (in_array($_POST['location'], array("lied","union","meier","sheldon","wick"))) {
$error_msg .= 'This location\'s outdoor events are not arranged through Landscape Services. Please contact them directly. <a href="http://www.unl.edu/unlspecialevents">Contact info available here</a>';
}
if (($_POST['location'] == 'other' && empty($_POST['location_other'])) ||
empty($_POST['location']) || empty($_POST['begindate_month']) || empty($_POST['begindate_day']) ||
empty($_POST['enddate_month']) || empty($_POST['enddate_day']) ||
empty($_POST['title']) || empty($_POST['starttime_hour']) || empty($_POST['endtime_hour']) || empty($_POST['attendance']) ||
empty($_POST['name']) || empty($_POST['email']) || empty($_POST['streetaddress']) || empty($_POST['city']) || empty($_POST['state']) || empty($_POST['zip']) ||
empty($_POST['business'])
) {
$error_msg .= 'Please fill out all required fields';
}
if (empty($error_msg)) {
$mailer = new UNL_WDN_Emailer_Main(); $mailer = new UNL_WDN_Emailer_Main();
$body .= "<h3>Event Information</h3>"; $body .= "<h3>Event Information</h3>";
...@@ -27,7 +43,7 @@ if (!empty($_POST)) { ...@@ -27,7 +43,7 @@ if (!empty($_POST)) {
$body .= "<strong>Email:</strong> " . $_POST['email'] . "<br/>"; $body .= "<strong>Email:</strong> " . $_POST['email'] . "<br/>";
$body .= "<strong>Address:</strong> " . $_POST['streetaddress'] . "<br/>"; $body .= "<strong>Address:</strong> " . $_POST['streetaddress'] . "<br/>";
$body .= "<strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong> " . $_POST['city']." ".$_POST['state']." ".$_POST['zip']. "<br />"; $body .= "<strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong> " . $_POST['city']." ".$_POST['state']." ".$_POST['zip']. "<br />";
$body .= "<strong>Business Phone:</strong> " . $_POST['business'] . "<br/>"; $body .= "<strong>Daytime Phone:</strong> " . $_POST['business'] . "<br/>";
$body .= "<strong>Home Phone:</strong> " . $_POST['home'] . "<br/>"; $body .= "<strong>Home Phone:</strong> " . $_POST['home'] . "<br/>";
$body .= "<strong>Fax:</strong> " . $_POST['fax'] . "<br/>"; $body .= "<strong>Fax:</strong> " . $_POST['fax'] . "<br/>";
...@@ -68,6 +84,7 @@ if (!empty($_POST)) { ...@@ -68,6 +84,7 @@ if (!empty($_POST)) {
header('Location: thankyou.php'); header('Location: thankyou.php');
exit(); exit();
} }
}
//set_include_path(dirname(dirname(dirname(dirname(__FILE__)))).'/lib/php/'.PATH_SEPARATOR.get_include_path()); //set_include_path(dirname(dirname(dirname(dirname(__FILE__)))).'/lib/php/'.PATH_SEPARATOR.get_include_path());
require_once 'UNL/Templates.php'; require_once 'UNL/Templates.php';
...@@ -80,6 +97,7 @@ $page->head .= <<<EOF ...@@ -80,6 +97,7 @@ $page->head .= <<<EOF
//<![CDATA[ //<![CDATA[
WDN.jQuery(document).ready(function($){ WDN.jQuery(document).ready(function($){
WDN.initializePlugin('zenform'); WDN.initializePlugin('zenform');
WDN.initializePlugin('notice');
$('#location').change(function() { $('#location').change(function() {
if ($(this).val() == 'lied' || if ($(this).val() == 'lied' ||
$(this).val() == 'union' || $(this).val() == 'union' ||
...@@ -217,7 +235,23 @@ $page->breadcrumbs = '<ul> ...@@ -217,7 +235,23 @@ $page->breadcrumbs = '<ul>
</ul>'; </ul>';
$page->titlegraphic = '<h1>Landscape Services</h1>'; $page->titlegraphic = '<h1>Landscape Services</h1>';
$page->pagetitle = '<h2>Outdoor Event Space Request</h2>'; $page->pagetitle = '<h2>Outdoor Event Space Request</h2>';
$page->maincontentarea = <<<EOF $page->maincontentarea = '';
if (isset($error_msg) && !empty($error_msg)) {
$page->maincontentarea .= <<<EOF
<div class="wdn_notice alert">
<div class="close">
<a href="#" title="Close this notice">Close this notice</a>
</div>
<div class="message">
<h4>Error</h4>
<p>{$error_msg}</p>
</div>
</div>
EOF;
}
$page->maincontentarea .= <<<EOF
<div class="three_col left"> <div class="three_col left">
<div class="infoBox"> <div class="infoBox">
...@@ -471,7 +505,7 @@ $page->maincontentarea .= <<<EOF ...@@ -471,7 +505,7 @@ $page->maincontentarea .= <<<EOF
<li style="clear:left;float:left"> <li style="clear:left;float:left">
<label for="business"> <label for="business">
<span class="required">*</span> <span class="required">*</span>
Business Phone Daytime Phone
</label> </label>
<input type="text" id="business" name="business" /> <input type="text" id="business" name="business" />
</li> </li>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment