custom form wont allow fo captcha to show. what to do?
Permalink
So I am trying to add field for simple captcha that is built in with concrete 5 but when I mark required field it wont show on the form. When I remove custom template for form it shows. so there is a problem with custom template. I did not built the form but I am trying to modify it cause I am getting spammed about 40 times a day on the good day on the bad day a lot more. please help. Here is the code for custom form template:
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$survey = $controller;
$miniSurvey = new MiniSurvey($b);
$miniSurvey->frontEndMode = true;
?>
<a name="<?php echo $survey->questionSetId ?>"></a>
<img src="<?=$this->getThemePath()?>/images/formHeader.png" width="326" height="46" style="margin-top: -46px; vertical-align: top; display: block; position: relative;" alt="Schedule Appointment Online" />
<div id="apptForm">
<?php if ($invalidIP) { ?>
<div class="ccm-error"><p><?php echo $invalidIP?></p></div>
<?php } ?>
<form enctype="multipart/form-data" id="miniSurveyView<?php echo intval($bID)?>" class="miniSurveyView" method="post" action="<?php echo $this->action('submit_form').'#'.$survey->questionSetId?>">
<!--
-->
<?php
if( $_GET['surveySuccess'] && $_GET['qsid']==intval($survey->questionSetId) ){ ?>
<div id="msg"><?php echo $survey->thankyouMsg ?></div>
<?php }elseif(strlen($formResponse)){ ?>
<div id="msg">
<?php echo $formResponse ?>
<?php
if (is_array($errors) && count($errors)) foreach($errors as $error){
echo '<div class="error">'.$error.'</div>';
} ?>
</div>
<?php } ?>
<input name="qsID" type="hidden" value="<?php echo intval($survey->questionSetId)?>" />
<input name="pURI" type="hidden" value="<?php echo $pURI ?>" />
<?php /* $miniSurvey->loadSurvey( $survey->questionSetId, 0, intval($bID) ); */ ?>
<?php
$hasError = (is_array($errors) && count($errors) > 0) ? true : false;
$questionsRS = $miniSurvey->loadQuestions(intval($survey->questionSetId), intval($bID), 0);
$questionRow = null;
function showQuestionError($hasError, $questionsRS, &$questionRow) {
$questionRow = $questionsRS->fetchRow();
if ($hasError) {
if ($questionRow['required']) {
echo '<span class="required">*</span>';
}
}
}
function showQuestionValue($questionRow) {
echo htmlspecialchars($_REQUEST['Question' . $questionRow['msqID']]);
}
?>
<p>Schedule appointment online for a specific day and time, and we will call you back with confirmation.</p>
<h3>Customer Info:</h3>
<div class="row block text">
<label for="formName">First and Last Name:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formName" name="Question1" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row block text">
<label for="formPhoneNumber">Phone Number:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formPhoneNumber" name="Question2" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row block text">
<label for="formEmail">Contact Email:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formEmail" name="Question3" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row block text">
<label for="formStreet">Street Name and Number:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formStreet" name="Question4" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row ibAll text">
<label for="formApt">Apt/Suite:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formApt" name="Question5" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row ibAll text">
<label for="formCity">City:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formCity" name="Question6" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row ibAll text">
<span style="min-width: 103px; margin-left: 3px;">State: California</span><label for="formZip" style="min-width: 40px; margin-left: 8px;">Zip:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formZip" name="Question7" style="width: 120px;" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<h3>Problem Description:</h3>
<div class="row block text">
<label for="formProblem">Problem with:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formProblem" name="Question8" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row block text">
<label for="formBrand">Brand Name:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formBrand" name="Question9" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row block text">
<label for="formDescription">Problem Description:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<textarea id="formDescription" name="Question10"><?php showQuestionValue($questionRow); ?></textarea>
</div>
<h3>Appointment Date and Time:</h3>
<div class="row ibAll text">
<label for="formDate">Date:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formDate" name="Question11" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row text">
<div class="ib ibAll" style="vertical-align: middle;"><label for="formTime">Time Slot:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label></div>
<?php
ob_start();
showQuestionValue($questionRow);
$question12Value = ob_get_contents();
ob_end_clean();
function isSelected($selectValue, $optionValue) {
if ($selectValue === $optionValue) {
echo ' selected="selected"';
}
}
?>
<select name="Question12" class="dropdown" title="Please choose" class="ib">
<option value="8-11am"<?php isSelected($question12Value, '8-11am'); ?>>8 – 11 am</option>
<option value="9-12pm"<?php isSelected($question12Value, '9-12pm'); ?>>9 – 12 pm</option>
<option value="10-1pm"<?php isSelected($question12Value, '10-1pm'); ?>>10 – 1 pm</option>
<option value="11-2pm"<?php isSelected($question12Value, '11-2pm'); ?>>11 – 2 pm</option>
<option value="12-3pm"<?php isSelected($question12Value, '12-3pm'); ?>>12 – 3 pm</option>
<option value="1-4pm"<?php isSelected($question12Value, '1-4pm'); ?>>1 – 4 pm</option>
<option value="2-5pm"<?php isSelected($question12Value, '2-5pm'); ?>>2 – 5 pm</option>
<option value="3-6pm"<?php isSelected($question12Value, '3-6pm'); ?>>3 – 6 pm</option>
<option value="4-7pm"<?php isSelected($question12Value, '4-7pm'); ?>>4 – 7 pm</option>
<option value="5-8pm"<?php isSelected($question12Value, '5-8pm'); ?>>5 – 8 pm</option>
</select>
<?php /*
<input type="text" id="formTime" name="Question12" value="<?php showQuestionValue($questionRow); ?>" />
*/ ?>
</div>
<div class="row block text">
<label for="formExtraInformation">Any other information about appointment:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<textarea id="formExtraInformation" name="Question13"><?php showQuestionValue($questionRow); ?></textarea>
</div>
<div class="row submit">
<input type="image" src="<?=$this->getThemePath()?>/images/submit.png" alt="Submit" />
</div>
</form>
</div>
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$survey = $controller;
$miniSurvey = new MiniSurvey($b);
$miniSurvey->frontEndMode = true;
?>
<a name="<?php echo $survey->questionSetId ?>"></a>
<img src="<?=$this->getThemePath()?>/images/formHeader.png" width="326" height="46" style="margin-top: -46px; vertical-align: top; display: block; position: relative;" alt="Schedule Appointment Online" />
<div id="apptForm">
<?php if ($invalidIP) { ?>
<div class="ccm-error"><p><?php echo $invalidIP?></p></div>
<?php } ?>
<form enctype="multipart/form-data" id="miniSurveyView<?php echo intval($bID)?>" class="miniSurveyView" method="post" action="<?php echo $this->action('submit_form').'#'.$survey->questionSetId?>">
<!--
-->
<?php
if( $_GET['surveySuccess'] && $_GET['qsid']==intval($survey->questionSetId) ){ ?>
<div id="msg"><?php echo $survey->thankyouMsg ?></div>
<?php }elseif(strlen($formResponse)){ ?>
<div id="msg">
<?php echo $formResponse ?>
<?php
if (is_array($errors) && count($errors)) foreach($errors as $error){
echo '<div class="error">'.$error.'</div>';
} ?>
</div>
<?php } ?>
<input name="qsID" type="hidden" value="<?php echo intval($survey->questionSetId)?>" />
<input name="pURI" type="hidden" value="<?php echo $pURI ?>" />
<?php /* $miniSurvey->loadSurvey( $survey->questionSetId, 0, intval($bID) ); */ ?>
<?php
$hasError = (is_array($errors) && count($errors) > 0) ? true : false;
$questionsRS = $miniSurvey->loadQuestions(intval($survey->questionSetId), intval($bID), 0);
$questionRow = null;
function showQuestionError($hasError, $questionsRS, &$questionRow) {
$questionRow = $questionsRS->fetchRow();
if ($hasError) {
if ($questionRow['required']) {
echo '<span class="required">*</span>';
}
}
}
function showQuestionValue($questionRow) {
echo htmlspecialchars($_REQUEST['Question' . $questionRow['msqID']]);
}
?>
<p>Schedule appointment online for a specific day and time, and we will call you back with confirmation.</p>
<h3>Customer Info:</h3>
<div class="row block text">
<label for="formName">First and Last Name:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formName" name="Question1" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row block text">
<label for="formPhoneNumber">Phone Number:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formPhoneNumber" name="Question2" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row block text">
<label for="formEmail">Contact Email:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formEmail" name="Question3" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row block text">
<label for="formStreet">Street Name and Number:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formStreet" name="Question4" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row ibAll text">
<label for="formApt">Apt/Suite:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formApt" name="Question5" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row ibAll text">
<label for="formCity">City:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formCity" name="Question6" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row ibAll text">
<span style="min-width: 103px; margin-left: 3px;">State: California</span><label for="formZip" style="min-width: 40px; margin-left: 8px;">Zip:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formZip" name="Question7" style="width: 120px;" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<h3>Problem Description:</h3>
<div class="row block text">
<label for="formProblem">Problem with:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formProblem" name="Question8" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row block text">
<label for="formBrand">Brand Name:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formBrand" name="Question9" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row block text">
<label for="formDescription">Problem Description:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<textarea id="formDescription" name="Question10"><?php showQuestionValue($questionRow); ?></textarea>
</div>
<h3>Appointment Date and Time:</h3>
<div class="row ibAll text">
<label for="formDate">Date:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<input type="text" id="formDate" name="Question11" value="<?php showQuestionValue($questionRow); ?>" />
</div>
<div class="row text">
<div class="ib ibAll" style="vertical-align: middle;"><label for="formTime">Time Slot:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label></div>
<?php
ob_start();
showQuestionValue($questionRow);
$question12Value = ob_get_contents();
ob_end_clean();
function isSelected($selectValue, $optionValue) {
if ($selectValue === $optionValue) {
echo ' selected="selected"';
}
}
?>
<select name="Question12" class="dropdown" title="Please choose" class="ib">
<option value="8-11am"<?php isSelected($question12Value, '8-11am'); ?>>8 – 11 am</option>
<option value="9-12pm"<?php isSelected($question12Value, '9-12pm'); ?>>9 – 12 pm</option>
<option value="10-1pm"<?php isSelected($question12Value, '10-1pm'); ?>>10 – 1 pm</option>
<option value="11-2pm"<?php isSelected($question12Value, '11-2pm'); ?>>11 – 2 pm</option>
<option value="12-3pm"<?php isSelected($question12Value, '12-3pm'); ?>>12 – 3 pm</option>
<option value="1-4pm"<?php isSelected($question12Value, '1-4pm'); ?>>1 – 4 pm</option>
<option value="2-5pm"<?php isSelected($question12Value, '2-5pm'); ?>>2 – 5 pm</option>
<option value="3-6pm"<?php isSelected($question12Value, '3-6pm'); ?>>3 – 6 pm</option>
<option value="4-7pm"<?php isSelected($question12Value, '4-7pm'); ?>>4 – 7 pm</option>
<option value="5-8pm"<?php isSelected($question12Value, '5-8pm'); ?>>5 – 8 pm</option>
</select>
<?php /*
<input type="text" id="formTime" name="Question12" value="<?php showQuestionValue($questionRow); ?>" />
*/ ?>
</div>
<div class="row block text">
<label for="formExtraInformation">Any other information about appointment:<?php showQuestionError($hasError, $questionsRS, $questionRow); ?></label>
<textarea id="formExtraInformation" name="Question13"><?php showQuestionValue($questionRow); ?></textarea>
</div>
<div class="row submit">
<input type="image" src="<?=$this->getThemePath()?>/images/submit.png" alt="Submit" />
</div>
</form>
</div>