Awesome, that seems to have done the job of it not submitting if the reCAPTCHA hasn't been checked. However, it has overridden any error message for the reCAPTCHA which isn't particularly UX friendly, so I am trying to add my own invalid state... but guess what... I can't make it work!
I have this for the server behaviours:
<?php
if ((isset($_POST["Insert"]) || isset($_POST["Insert_x"]))) {
$WAFV_Redirect = "".(htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)) ."?invalid=true";
$_SESSION['WAVT_requestcallback_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ((isset($_POST["fld_cb_title"])?$_POST["fld_cb_title"]:"") . "",true,1);
$WAFV_Errors .= WAValidateRQ((isset($_POST["fld_cb_fname"])?$_POST["fld_cb_fname"]:"") . "",true,2);
$WAFV_Errors .= WAValidateRQ((isset($_POST["fld_cb_lname"])?$_POST["fld_cb_lname"]:"") . "",true,3);
$WAFV_Errors .= WAValidateEM((isset($_POST["fld_cb_email"])?$_POST["fld_cb_email"]:"") . "",true,4);
$WAFV_Errors .= WAValidateRQ((isset($_POST["fld_cb_country"])?$_POST["fld_cb_country"]:"") . "",true,5);
$WAFV_Errors .= WAValidateRQ((isset($_POST["fld_cb_telephone"])?$_POST["fld_cb_telephone"]:"") . "",true,6);
$WAFV_Errors .= WAValidateRQ((isset($_POST["fld-cb_calltime"])?$_POST["fld-cb_calltime"]:"") . "",true,7);
$WAFV_Errors .= WAValidateRQ(($succMsg) . "",true,8);
if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"requestcallback");
}
}
?>
And I have this for my validation error message:
<div class="lineGroup">
<div class="g-recaptcha" data-sitekey="qwertyuioplkjhgfdsazxcvbnm"></div>
<?php
if (ValidatedField('requestcallback','requestcallback')) {
if ((strpos((",".ValidatedField("requestcallback","requestcallback").","), "," . "8" . ",") !== false || "8" == "")) {
if (!(false)) {
?><span class="serverInvalidState" id="$succMsg">Hmmm... it seems you might be a robot! Click to prove you're not.</span><?php //WAFV_Conditional request-call-back.php requestcallback(7:)
}
}
}?>
</div>
I assume I'm missing something from the Server Validation behaviour because there seems to be nothing to tie the reCAPTCHA to the invalid state. What, I don't know though!
Just thinking on the fly as I type this, should I add a name or ID to the reCAPTCHA that can then be picked up by the WA Server Validation panel?
Thanks so far Ray.