Captcha not showing in extended form in Stack
Permalink
April 25, 2017 at 7:08 PM
I have taken over a site from another developer. They have Extended Form installed and working properly with Captcha in Contact Us page, etc. However, there is another form in a flyout when you hover on "Request Estimate". I have ticked the box for Captcha but it won't show no matter what. Below is the code from the template the form is using..
<?php
defined ( 'C5_EXECUTE' ) or die ( "Access Denied." ) ;
$survey = $controller ;
//echo $survey->surveyName.'<br>';
$miniSurvey = new MiniSurvey( $b ) ;
$miniSurvey -> frontEndMode = true ;
global $c ;
?>
<div class="req_est">
<a href="#">Request Estimate</a>
</div>
<a name="<?php echo $survey -> questionSetId ?> " style="display:none;"></a>
<?php if ( $invalidIP ) { ?>
<div class="ccm-error">
<p><?php echo $invalidIP ?> </p>
<?php
defined ( 'C5_EXECUTE' ) or die ( "Access Denied." ) ;
$survey = $controller ;
//echo $survey->surveyName.'<br>';
$miniSurvey = new MiniSurvey( $b ) ;
$miniSurvey -> frontEndMode = true ;
global $c ;
?>
<div class="req_est">
<a href="#">Request Estimate</a>
</div>
<a name="<?php echo $survey -> questionSetId ?> " style="display:none;"></a>
<?php if ( $invalidIP ) { ?>
<div class="ccm-error">
<p><?php echo $invalidIP ?> </p>
</div>
<?php } ?>
<div class="esti_form hidden">
<?php
$stack = Stack:: getByName ( 'Request Estimate Form Text' ) ;
$stack -> display ( ) ;
?>
<form enctype="multipart/form-data" id="miniSurveyView<?php echo intval ( $bID ) ?> " class="miniSurveyView reqform" method="post" action="<?php echo $this -> action ( 'submit_form' ) . '#' . $survey -> questionSetId ?> ">
<?php if ( $_GET [ 'surveySuccess' ] && $_GET [ 'qsid' ] == intval ( $survey -> questionSetId ) ) { ?>
<script type="text/javascript">
$(document).ready(function(){
alert('<?php echo $survey -> thankyouMsg ?> ');
});
</script>
<?php } elseif ( strlen ( $formResponse ) ) { ?>
<!-- <div id="msg"><strong style="color:red;">-->
<?php //echo $formResponse ?>
<?php
if ( is_array ( $errors ) && count ( $errors ) ) foreach ( $errors as $error ) {
//echo '<div class="error">'.$error.'</div>';
$diser .= $error . '\n' ;
} ?>
<!--</strong> </div>-->
<script type="text/javascript">
$(document).ready(function(){
alert('<?php echo $diser ?> ');
});
</script>
<?php } ?>
<input name="qsID" type="hidden" value="<?php echo intval ( $survey -> questionSetId ) ?> " />
<input name="pURI" type="hidden" value="<?php echo $pURI ?> " />
<?php
$questionsRS = $miniSurvey -> loadQuestions ( intval ( $survey -> questionSetId ) , intval ( $bID ) , 0 ) ;
$i = 0 ;
$isfirst = true ;
while ( $questionRow = $questionsRS -> fetchRow ( ) ) {
$requiredSymbol = ( $questionRow [ 'required' ] ) ? ' *' : '' ;
if ( $isfirst ) { $i = $start = $questionRow [ 'msqID' ] ; $isfirst = false ; }
/*
echo '<div class="ccmFormBlock-field-wrapper" id="ccmFormBlock-field-wrapper-'. intval($questionRow["msqID"]) .'">';
echo '<div class="question-label">'.$questionRow['question'].''.$requiredSymbol.'</div>';
echo '<div class="question-input">'.$miniSurvey->loadInputType($questionRow, 0).'</div>';
echo '<div class="clear"></div>'; // might be required for multicolumn output
echo '</div>';// ccmFormBlock-field-wrapper*/
?>
<input type="hidden" id="msqID-<?php echo $questionRow [ 'msqID' ] ; ?> " value="<?php echo $questionRow [ 'question' ] . $requiredSymbol ?> " />
<?php echo $miniSurvey -> loadInputType ( $questionRow , 0 ) ; ?>
<?php
$i ++;
}
?>
<a class="esti_click" href="javascript:void(0);" onclick="clearval()"><?php echo t( 'Submit' ) ?> </a>
<a href="#" class="closeform">Close</a>
</form>
</div>
<script type="text/javascript">
$(document).ready(function(){
//alert('<?php echo $start ?> ');
// console.log(<?php echo $start ?> );
// for(var i=<?php echo $start ?> ;i<= <?= $i ?> ;i++){
//
// var value=$('#miniSurveyView<?php echo intval ( $bID ) ?> #msqID-'+i).val();
// if(i==25){
// console.log(value);
// }
// $("#miniSurveyView<?php echo intval ( $bID ) ?> #Question"+i).attr('placeholder',value);
// }
$('#miniSurveyView<?php echo intval ( $bID ) ?> ').find('input[type=hidden]').each(function(){
var id = $(this).attr('id');
var value = $(this).val();
if(id && value){
var arr = id.split('-');
console.log(arr[1]);
$(this).next('input[name=Question'+arr[1]+']').attr('placeholder',value);
}
});
$('.esti_click').click(function(){
for(var i=1;i<=<?= $i ?> ;i++){
var value=$('#miniSurveyView<?php echo intval ( $bID ) ?> #msqID-'+i).val();
if($("#miniSurveyView<?php echo intval ( $bID ) ?> #Question"+i).val()==value){
$("#miniSurveyView<?php echo intval ( $bID ) ?> #Question"+i).val('');
}
}
var error ='';
if($.trim($('#Question3').val())==''){
error=error+'Please enter Name\n';
}
if($.trim($('#Question5').val())==''){
error=error+'Please enter Email\n';
}
console.log(error);
if(error!=''){
alert(error);
}else{
$('#miniSurveyView<?php echo intval ( $bID ) ?> ').submit();
}
});
});
$('#miniSurveyView<?php echo intval ( $bID ) ?> input').click(function(e){
var attrarr=$(this).attr('id');
if (typeof attrarr === "undefined") {
return;
}
var id=attrarr.replace(/Question/g,'n');
var currentval=$(this).val();
var fieldname=$('#msqID-'+id).val();
if(fieldname==currentval){
$(this).val('');
}
});
$('#miniSurveyView<?php echo intval ( $bID ) ?> input').blur(function(e){
var attrarr=$(this).attr('id');
if (typeof attrarr === "undefined") {
return;
}
var id=attrarr.replace(/Question/g,'n');
var currentval=$(this).val();
var fieldname=$('#msqID-'+id).val();
if(currentval==''){
$(this).val(fieldname);
}
});
$('#miniSurveyView<?php echo intval ( $bID ) ?> textarea').click(function(e){
var attrarr=$(this).attr('id');
if (typeof attrarr === "undefined") {
return;
}
var id=attrarr.replace(/Question/g,'n');
var currentval=$(this).val();
var fieldname=$('#msqID-'+id).val();
if(fieldname==currentval){
$(this).val('');
}
});
$('#miniSurveyView<?php echo intval ( $bID ) ?> textarea').blur(function(e){
var attrarr=$(this).attr('id');
if (typeof attrarr === "undefined") {
return;
}
var id=attrarr.replace(/Question/g,'n');
var currentval=$(this).val();
var fieldname=$('#msqID-'+id).val();
if(currentval==''){
$(this).val(fieldname);
}
});
</script>
<script type="text/javascript">
jQuery(document).ready(function() {
$('.req_est').mouseover(function() {
$('.esti_form').removeClass('hidden');
});
$('.closeform').click(function() {
$('.esti_form').addClass('hidden');
});
});
</script>
<style type="text/css">
.esti_form a{
color: #DF2C23;
}
.esti_form p {
color: #fff !important;
}
.esti_form a.esti_click {
background: none;
background-color: #ef000c;
color: #fff;
padding: 6px 27px;
font-weight: 600;
text-transform: capitalize;
border-radius: 5px;
margin: 0px 0 0 0;
display: inline-block;
text-align: center;
}
.esti_form input {
border: 0;
width: 100%;
margin-bottom: 10px;
border-radius: 5px;
padding-left: 10px;
color:#000;;
}
.esti_form {
width: 300px;
float: right;
margin-top: 0;
background-color: #282828;
/*margin-right: 45px;*/
padding-left: 16px;
padding-top: 10px;
clear:both;
padding: 20px 20px 10px;
}
.esti_form a {
text-align: right;
display: block;
background: none;
background-color: #ef000c;
color: #fff;
padding: 6px 15px;
font-weight: 600;
text-transform: capitalize;
border-radius: 5px;
margin: 0px 0 0 0;
display: inline-block;
text-align: center;
}
a.closeform {
float: right;
/* padding: 0; */
margin: 0;
width: 40%;
}
</style>