Templatebeispiel
<div class="form-group">
<label class="col-md-4 control-label" for="captcha-image"></label>
<div class="col-md-3">[CaptchaImage]</div>
<div class="col-md-5"><a class="btn btn-default" href="javascript:CaptchaRefresh();"><span class="glyphicon glyphicon-refresh"></span></a></div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="captcha-note"></label>
<div class="col-md-8"><span class="alert-text">[localize:captcha_enter_code]</span></div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="captcha-text"></label>
<div class="col-md-3">[tb:captchatext:class="form-control"]</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="captcha-errormessage"></label>
<div class="col-md-8">
<span class="alert-text" [mvif:errorcode:eq:1]>[localize:captcha_not_correct]</span>
</div>
</div>
Templatebeispiel mit Ajax (Aufruf ohne Postback)
<script type="text/javascript">
function GetCaptcha() {
try {
PageMethods.set_path(baseurl + "desktopdefault.aspx/");
PageMethods.GetCaptchaCode(onSucceeded, onFailed);
catch (e) {
}
function onSucceeded(result) {
{
if (document.getElementById('<%=captchatext.clientid%>').value == result )
sendForm();
else
document.getElementById('msg').innerHTML = 'Falscher Code';
}
}
function onFailed(error) {
alert(error);
}
</script>
<div class="form-group">
<label class="col-md-4 control-label" for="captcha-image"></label>
<div class="col-md-3">[CaptchaImage]</div>
<div class="col-md-5"><a class="btn btn-default" href="javascript:CaptchaRefresh();"></a></div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="captcha-note"></label>
<div class="col-md-8"><span class="alert-text">Bitte Code eingeben</span></div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="captcha-text"></label>
<div class="col-md-3">[tb:captchatext:class="form-control"]</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="captcha-errormessage"></label>
<div class="col-md-8">
<span id="msg" class="alert-text"></span>
</div>
</div>
<a href="javascript:GetCaptcha();">Formular absenden</a>
Im korrespondierenden Mailformular-Template muss die aufgerufene Funktion sendForm definiert sein. Diese löst dann das Absenden des Formulars über den Button mit der ID senden (beispielsweise) aus:
function sendForm() { document.getElementById('<%=senden.ClientID%>').click(); }
[lbn:senden:text="" CommandName="Update"]