Advertisement
| Hall of Fame |
|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: |
<?php
/* BEGIN - SECTION 1 */
require_once(dirname(__FILE__) . "/../../FORMfields.php");
//require_once($_SERVER["DOCUMENT_ROOT"] . "/FORMfields/FORMfields.php"); // Absolute path
//$GLOBALS["FF_GLOBALS_VERBOSE"] = true; // For debugging purposes
//$GLOBALS["FF_GLOBALS_SEND_EMAILS"] = false; // For debugging purposes
// ---------- FORM PROPERTIES - START ----------
// NOTE: Only changes made to the form properties and structure
// (not actions) of the form can be reloaded into FORMgen.
define("FF_SLEEP", 4);
define("FF_FORM_NAME", "general_enquiry");
define("FF_FORM_TITLE", htmlspecialchars("General Enquiry"));
define("FF_STYLE_FILE", FF_ROOT_URL . "/styles/default.css");
define("FF_SHOW_W3C_VALIDATOR", false);
define("FF_DISPLAY_CONFIRMATION", true); // Note: Static form layout is not compatible with the confirmation screen.
define("FF_DISPLAY_THANK_YOU_PAGE", true);
define("FF_INSERT_INTO_DB", false);
define("FF_SEND_FORM_EMAIL1", true);
define("FF_FORM_EMAIL1_TO", "steve.b@madscience.com.au,steve@madscience.com,alex@madscience.com");
define("FF_FORM_EMAIL1_TO_FIELDS", "");
define("FF_FORM_EMAIL1_FROM", "Sales.Enquiry@madscience.com.au"); // Note: You cannot specify a FF_FORM_EMAIL1_FROM and FF_FORM_EMAIL1_FROM_FIELD!
define("FF_FORM_EMAIL1_FROM_FIELD", "");
define("FF_FORM_EMAIL1_SUBJECT", "General Enquiry Submission");
define("FF_FORM_EMAIL1_MESSAGE_HEADER", "Before Calling Customer - Check with MS Staff to ensure that no one else has.");
define("FF_FORM_EMAIL1_MESSAGE_FOOTER", "");
define("FF_FORM_EMAIL1_USE_HTML", true);
define("FF_FORM_EMAIL1_SEND_FORM_DATA", true);
define("FF_SEND_FORM_EMAIL2", false);
define("FF_FORM_EMAIL2_TO", "");
define("FF_FORM_EMAIL2_TO_FIELDS", "");
define("FF_FORM_EMAIL2_FROM", ""); // Note: You cannot specify both a FF_FORM_EMAIL2_FROM and FF_FORM_EMAIL2_FROM_FIELD!
define("FF_FORM_EMAIL2_FROM_FIELD", "");
define("FF_FORM_EMAIL2_SUBJECT", "General Enquiry Submission");
define("FF_FORM_EMAIL2_MESSAGE_HEADER", "");
define("FF_FORM_EMAIL2_MESSAGE_FOOTER", "");
define("FF_FORM_EMAIL2_USE_HTML", true);
define("FF_FORM_EMAIL2_SEND_FORM_DATA", true);
$GLOBALS["FF_CANCEL_URL"] = "/";
$GLOBALS["FF_DONE_URL"] = "http://www.madscience.com/locations/nsw/ourservices.aspx?lang=1";
$GLOBALS["FF_DEFAULTS"] = array(
);
// ---------- FORM PROPERTIES - END ----------
// ---------- FORM STRUCTURE - START ----------
$ffForm = new FfForm();
$ffForm->addField(new HeaderField("GeneralEnquiry", "How may we help you?"));
$ffForm->addField(new DropDownField("HelpItems", "Type of Assistance Required", FORM_FIELD_REQUIRED, array("General Enquiry","School Program Enquiry","Camp Enquiry","Corporate Event Enquiry","Party Enquiry","Book an Event","Would like more Information."), null, null, "on"));
$ffForm->formFields["HelpItems"]->setHelp("Select the most appropriate option from the list. If your enquiry is not listed. Please specify how we can help you.");
$ffForm->formFields["HelpItems"]->setFieldBelowLabel("on");
$ffForm->addField(new TextAreaField("Query", "What is your enquiry?", FORM_FIELD_REQUIRED, 600, 15, 15, 65));
$ffForm->formFields["Query"]->setFieldBelowLabel("on");
$ffForm->addField(new PersonNameField("Name", "Your Name", FORM_FIELD_REQUIRED));
$ffForm->addField(new DescriptionField("Desc_ContactHow", "How would you like us to contact you?"));
$ffForm->addField(new CheckboxGroupField("ContactBy", "Contact me by", FORM_FIELD_REQUIRED, array("Phone:","Mobile:","Email:"), null, 1, null));
$ffForm->formFields["ContactBy"]->setHelp("You may choose more than one option.");
$ffForm->formFields["ContactBy"]->setFieldBelowLabel("on");
$ffForm->addField(new EmailAddrField("Email", "Email", FORM_FIELD_NOT_REQUIRED));
$ffForm->addField(new IntlPhoneNumberField("Phone", "Phone", FORM_FIELD_NOT_REQUIRED));
$ffForm->addField(new IntlPhoneNumberField("Mobile", "Mobile", FORM_FIELD_NOT_REQUIRED));
$ffForm->addField(new SubmitField("ff_submit", "Submit"));
$ffForm->addField(new SubmitField("ff_clear", "Clear"));
// ---------- FORM STRUCTURE - END ----------
// ---------- FORM ACTIONS - START ----------
class SubmitButtonListener extends FfButtonListener
{
function onClick(&$ffForm)
{
if ($ffForm->checkValues()) {
// CONFIRMATION OPERATION:
$ffForm->setEditable(false);
$ffForm->setEditableFields(array("ff_back", "ff_confirm"), true);
$ffForm->setHiddenFields(array("ff_back", "ff_confirm"), false);
$GLOBALS["action"] = FF_CONFIRM;
}
}
}
class ConfirmButtonListener extends FfButtonListener
{
function onClick(&$ffForm)
{
//echo "CONFIRM<hr/>";
if ($ffForm->checkValues()) {
// SUBMIT OPERATION:
$GLOBALS["action"] = FF_DONE;
// Send an email?
if (FF_SEND_FORM_EMAIL1)
{
$formEmail1To = FF_FORM_EMAIL1_TO;
// Add the to addresses which were entered by the user
$formEmail1ToFields = split(",", FF_FORM_EMAIL1_TO_FIELDS);
foreach($formEmail1ToFields as $fieldName) {
if (!empty($fieldName))
$formEmail1To .= "," . $ffForm->getValue($fieldName);
}
// Was the address specified or are we loading from a field name?
$formEmail1From = FF_FORM_EMAIL1_FROM;
if (!FormField::isBlank(FF_FORM_EMAIL1_FROM_FIELD)) {
$formEmail1From = $ffForm->getValue(FF_FORM_EMAIL1_FROM_FIELD);
}
$formEmail1Cc = null;
$formEmail1Bcc = null;
$formEmail1Subject = FF_FORM_EMAIL1_SUBJECT;
$formEmail1MsgHeader = FF_FORM_EMAIL1_MESSAGE_HEADER; // The text that preceeds the field values
$formEmail1MsgFooter = FF_FORM_EMAIL1_MESSAGE_FOOTER; // The text that follows the field values
$formEmail1CssFile = null; // If you don't like the defaulted CSS styles, you can include another style sheet.
$formEmail1UseHtml = FF_FORM_EMAIL1_USE_HTML; // Use false for text emails
$formEmail1SendFormData = FF_FORM_EMAIL1_SEND_FORM_DATA; // Use false to not send form data
$formEmail1SendFormUploads = true; // Use false to not attach files uploaded from the form
if (!$formEmail1UseHtml) { // Convert the line of text to multiple lines?
$formEmail1MsgHeader = str_replace("<br/>", "\n", $formEmail1MsgHeader);
$formEmail1MsgFooter = str_replace("<br/>", "\n", $formEmail1MsgFooter);
}
// You can include extra attachments by populating an array as follows.
// Note: All UploadFields are automatically attached to the email.
$formEmail1Attachments = null;
//$formEmail1Attachments[0] = array(dirname(__FILE__) . "/../calendar.gif", "calendar.gif");
$ffForm->email($formEmail1To, $formEmail1Subject, $formEmail1From,
$formEmail1Cc, $formEmail1Bcc, $formEmail1MsgHeader,
$formEmail1MsgFooter, $formEmail1Attachments, $formEmail1UseHtml,
$formEmail1CssFile, $formEmail1SendFormData, $formEmail1SendFormUploads);
}
// Send a second email?
if (FF_SEND_FORM_EMAIL2)
{
$formEmail2To = FF_FORM_EMAIL2_TO;
// Add the to addresses which were entered by the user
$formEmail2ToFields = split(",", FF_FORM_EMAIL2_TO_FIELDS);
foreach($formEmail2ToFields as $fieldName) {
if (!empty($fieldName))
$formEmail2To .= "," . $ffForm->getValue($fieldName);
}
$formEmail2From = FF_FORM_EMAIL2_FROM;
if (!FormField::isBlank(FF_FORM_EMAIL2_FROM_FIELD)) {
$formEmail2From = $ffForm->getValue(FF_FORM_EMAIL2_FROM_FIELD);
}
$formEmail2Cc = null;
$formEmail2Bcc = null;
$formEmail2Subject = FF_FORM_EMAIL2_SUBJECT;
$formEmail2MsgHeader = FF_FORM_EMAIL2_MESSAGE_HEADER; // The text that preceeds the field values
$formEmail2MsgFooter = FF_FORM_EMAIL2_MESSAGE_FOOTER; // The text that follows the field values
$formEmail2CssFile = null; // If you don't like the defaulted CSS styles, you can include another style sheet.
$formEmail2UseHtml = FF_FORM_EMAIL2_USE_HTML; // Use false for text emails
$formEmail2SendFormData = FF_FORM_EMAIL2_SEND_FORM_DATA; // Use false to not send form data
$formEmail2SendFormUploads = true; // Use false to not attach files uploaded from the form
if (!$formEmail2UseHtml) { // Convert the line of text to multiple lines?
$formEmail2MsgHeader = str_replace("<br/>", "\n", $formEmail2MsgHeader);
$formEmail2MsgFooter = str_replace("<br/>", "\n", $formEmail2MsgFooter);
}
// You can include extra attachments by populating an array as follows.
// Note: All UploadFields are automatically attached to the email.
$formEmail2Attachments = null;
//$formEmail2Attachments[0] = array(dirname(__FILE__) . "/../calendar.gif", "calendar.gif");
$ffForm->email($formEmail2To, $formEmail2Subject, $formEmail2From,
$formEmail2Cc, $formEmail2Bcc, $formEmail2MsgHeader,
$formEmail2MsgFooter, $formEmail2Attachments, $formEmail2UseHtml,
$formEmail2CssFile, $formEmail2SendFormData, $formEmail2SendFormUploads);
}
if (FF_INSERT_INTO_DB) {
$ffForm->addField(new DateTimeField("ff_inserted_on", "Inserted On", FORM_FIELD_REQUIRED, null));
$ffForm->formFields["ff_inserted_on"]->getCurrentDateTime();
$ffForm->insertValuesIntoDb(FF_FORM_NAME);
}
if (!FF_DISPLAY_THANK_YOU_PAGE) {
header("Location: " . $GLOBALS["FF_DONE_URL"]);
}
}
}
}
if ($ffForm->fieldExists("ff_submit")) {
// Does the submit button submit the data or confirm the data?
if (FF_DISPLAY_CONFIRMATION)
$ffForm->formFields["ff_submit"]->addButtonListener(new SubmitButtonListener());
else
$ffForm->formFields["ff_submit"]->addButtonListener(new ConfirmButtonListener());
}
if ($ffForm->fieldExists("ff_clear")) {
$ffForm->formFields["ff_clear"]->addButtonListener(new FfClearButtonListener());
}
class CancelButtonListener extends FfButtonListener
{
function onClick(&$ffForm)
{
// CANCEL OPERATION:
header("Location: " . $GLOBALS["FF_CANCEL_URL"]);
}
}
if ($ffForm->fieldExists("ff_cancel")) {
$ffForm->formFields["ff_cancel"]->addButtonListener(new CancelButtonListener());
}
$ffForm->addField(new SubmitField("ff_back", "<" . FfLH::t("Back")));
$confirmButton = new SubmitField("ff_confirm", FfLH::t("Confirm") . ">");
$confirmButton->addButtonListener(new ConfirmButtonListener());
$ffForm->addField($confirmButton);
class FormListener extends FfFormListener
{
function onNoClicks(&$ffForm)
{
// DEFAULT OPERATION:
// If necessary, convert the default values to multiple lines
if (sizeof($GLOBALS["FF_DEFAULTS"]) > 0) {
foreach ($GLOBALS["FF_DEFAULTS"] as $i=>$globalValue) {
$GLOBALS["FF_DEFAULTS"][$i] = str_replace("<br/>", "\n", $globalValue);
}
}
$ffForm->loadDbValues($GLOBALS["FF_DEFAULTS"]);
// Enter other default values here. Example:
//$ffForm->setValue("name", "John");
}
}
$ffForm->addFormListener(new FormListener());
define("FF_ENTER", 1);
define("FF_CONFIRM", 2);
define("FF_DONE", 3);
$GLOBALS["action"] = FF_ENTER;
$ffForm->setHiddenFields(array("ff_back", "ff_confirm"), true);
$ffForm->process();
// ---------- FORM ACTIONS - END ----------
/* END - SECTION 1 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?= FF_FORM_TITLE ?></title>
<? /* BEGIN - SECTION 2 */ ?>
<? require_once(FF_SRC . "/FfIncludes.php"); ?>
<? if ($GLOBALS["action"] == FF_DONE) { ?>
<meta http-equiv="Refresh" content="<?= FF_SLEEP ?>; url=<?= $GLOBALS["FF_DONE_URL"] ?>">
<? } ?>
<style type="text/css">
/* Sometimes it is useful to specify a label width */
/*label.notValid, label.isValid, label.disabled, label.display {
width: 150px;
}*/
</style>
<? /* END - SECTION 2 */ ?>
</head>
<body onload="setFocus();" class="FORMfields">
<? /* BEGIN - SECTION 3 */ ?>
<div class="ffForm">
<a name="ffStart"></a>
<?
// For debugging:
// print_r($_REQUEST);
// echo $ffForm->__toString();
?>
<form name="<?= $ffForm->getFormName() ?>" action="#ffStart" method="post" enctype="multipart/form-data">
<?= FfMenuHelper::getSectionTitleHeader(FF_FORM_TITLE) ?>
<? if ($GLOBALS["action"] == FF_DONE) { ?>
<br />
<div class="ffConfirmation">
<?= FfLH::t("Thank you for your submission.") ?>
</div>
<div class="ffRedirectNote">
<a href="<?= $GLOBALS["FF_DONE_URL"] ?>"><?= (FfLH::t("Please click here if your browser does not redirect in") . " " . FF_SLEEP . " " . FfLH::t("seconds") . ".") ?></a>
</div>
<br />
<? } else {
if ($GLOBALS["action"] == FF_CONFIRM) {
?>
<h3 class="FORMfields">
<?= FfLH::t("Please confirm that the following data is correct:") ?>
</h3>
<?
} else {
?>
<div style="text-align:right;margin-bottom:10px;">
<span class="required">*</span><span class="help" style="padding-left:0px;font-size:9px;"> - <?= FfLH::t("required") ?></span>
</div>
<?
}
echo $ffForm->getTableTag();
} ?>
<?= FfMenuHelper::getSectionTitleFooter() ?>
<div style="text-align:right;">
<a href="<?= FF_ROOT_URL ?>" target="_blank"><img class="ffTinyLogo" alt="FORMfields, The Premiere Web Framework." src="http://www.worldsplayground.com/FORMfields/images/blank.gif"/></a><a style="font: normal normal normal 9px verdana,sans-serif;" href="http://www.formfields.com" target="_blank">Form Generated by FORMgen</a>
</div>
<? if (FF_SHOW_W3C_VALIDATOR) { ?>
<div>
<a href="http://validator.w3.org/check?uri=referer"><img border="0" src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" /></a>
</div>
<? } ?>
</form>
</div>
<? /* END - SECTION 3 */ ?>
</body>
</html>
|