I use formit with the hook math. Unfortunately I always get the error “Invalid value”, although the entered result is correct.
After clearing the ModX cache, the form works once. If I want to use the form again, the same error comes again.
[[!FormIt?
&hooks=`math,spam,email,FormItAutoResponder`
&emailSubject=`Kontaktformular - [[+name]]`
&emailTpl=`emailSend`
&emailTo=`xy@...`
&emailFrom=`xy@...`
&emailFromName=`[[+name]]`
&emailReplyTo=`[[+email]]`
&emailReplyToName=`[[+name]]`
&fiarTpl=`contactSendFiar`
&fiarSubject=`Sendebestätigung - Anfrage [[++site_name]]`
&fiarFrom=`xy@...`
&fiarFromName=`[[++site_name]]`
&mathMinRange=`10`
&mathMaxRange=`50`
&validate=`name:required,email:email:required,datenschutz:required,special:blank,math:required,text:required`
&successMessage=`[[$tplContactThanks]]`
&validationErrorMessage=`bitte füllen Sie alle Pflichtfelder korrekt aus.`
&datenschutz.vTextRequired=`Bitte akzeptieren Sie die Datenschutzerklärung`
&emailMultiSeparator=`<br>`
]]
[[!+fi.successMessage]]
[[!$tplContactForm]]
Chunk: tplContactForm
<div class="mid">
[[!+fi.validation_error_message:notempty=`<p class="error">[[!+fi.validation_error_message]]</p>`]]
</div>
<form action="[[~[[*id]]]]#footer" method="post" class="form">
<input type="hidden" name="nospam:blank" value="[[+fi.nospam]]" />
<div uk-grid class="uk-grid-medium">
<div class="uk-width-1-1">
<div class="mid">
<input type="text" name="name" id="name" value="[[!+fi.name:htmlent]]" placeholder="Name" >
[[!+fi.error.name]]
</div>
<hr />
</div>
<div class="uk-width-1-1">
<div class="mid">
<input type="email" name="email" id="email" value="[[!+fi.email:htmlent]]" placeholder="Email" >
[[!+fi.error.email]]
</div>
<hr />
</div>
<div class="uk-width-1-1 fiSpecial mid">
<input type="text" name="special" id="special" value="[[!+fi.special:htmlent]]" placeholder="Special" >
[[!+fi.error.special]]
</div>
<div class="uk-width-1-1">
<div class="mid">
<textarea name="text" id="text" value="[[!+fi.text]]" placeholder="Ihre Nachricht" >[[!+fi.text:htmlent]]</textarea>
[[!+fi.error.text]]
</div>
<hr />
</div>
<div class="mid uk-width-1-1">
<div uk-grid class="uk-grid-medium">
<div class="uk-width-1-2@s">
<input type="checkbox" name="datenschutz[]" id="datenschutz" value="Ja" [[!+fi.datenschutz:FormItIsChecked=`Ja`]] class="css-checkbox"><label for="datenschutz" class="css-label"><span></span>
Ich stimme der <a href="[[~id]]" uk-toggle >Datenschutzerklärung</a> zu.</label>[[!+fi.error.datenschutz]]
</div>
<div class="uk-width-1-2@s">
<label><strong>Sicherheitsfrage:</strong> Wie viel ist [[!+fi.op1]] [[!+fi.operator:is=`-`:then=`minus`:else=`plus`]] [[!+fi.op2]]?</label>
[[!+fi.error.math]]
<input type="text" name="math" value="[[!+fi.math]]" placeholder="Ergebnis hier eintragen" />
<input type="hidden" name="op1" value="[[!+fi.op1]]" />
<input type="hidden" name="op2" value="[[!+fi.op2]]" />
<input type="hidden" name="operator" value="[[!+fi.operator]]" />
</div>
<div class="uk-width-2-3@s">
<input type="submit" value="Anfrage senden" class="submit">
</div>
<div class="uk-width-1-3@s uk-text-right">
Alle Felder sind Pflichtfelder
</div>
</div>
</div>
</div>
</form>
Modx 3.0.3
PHP 8.1
Formit 5.0.1