[[+content_image]]
P
P
photosho2020-03-06 11:44:11
MODX
photosho, 2020-03-06 11:44:11

Why is the form submitted even if the Math is wrong?

I connect ajaxForm like this:

[[!AjaxForm? 
  &form=`tpl.AjaxForm.5` 
  &snippet=`FormIt` 
  &hooks=`math,FormItSaveForm,email` 
  &mathMinRange=`1`
  &mathMaxRange=`10`
  &emailSubject=``
  &emailTo=`[[#8.tv_01]]`
  &emailFrom=`[[#8.tv_01]]`
  &emailTpl=`tpl.email.4`
  &validate=`math:required,name4:required,phone4:required,workemail4:blank,text4:required:stripTags`
  &submitVar=`form4`
  &validationErrorMessage=`В форме содержатся ошибки!`
  &successMessage=`Сообщение успешно отправлено`
]]


In the template, I set the captcha:

<div class="math">        
    <div class="math_1">
        [[!+fi.op1]] [[!+fi.operator]] [[!+fi.op2]]
    </div>
    <div class="math_2">
    <input class="form-control" type="text" name="math" value="[[!+fi.math]]" />
    <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>


The "math" field is correctly considered required, but the form is submitted for any value entered in it. What's the matter?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question