A
A
a_palanski2018-02-09 15:36:11
MODX
a_palanski, 2018-02-09 15:36:11

How to check if the checkbox is selected in Modx revo?

Good afternoon, how to check if the checkbox is selected in Modx revo?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Golyagin, 2018-03-03
@webrevenue

If the checkbox is required, just specify required, for example

<input type="checkbox" name="agree[]" value="1" required >
and all)

A
Alex-1917, 2018-02-09
@alex-1917

I know how to check on js
How to check in ModX Revo - no, you haven't heard of it... )
)
- drakosha.shop/opt

I
Igor, 2018-02-15
@ig0r74

Here is an example for Formit

<div class="form-group">
    <input type="hidden" name="agree[]" value="" />
    <input type="checkbox" name="agree[]" value="1" class=""  > <span class="mf-req">*</span>
    <small>Отправляя сообщение, я принимаю <a href="terms/">пользовательское соглашение</a> и подтверждаю, что ознакомлен и согласен с <a href="privacy/">политикой конфиденциальности</a> данного сайта</small>
    <br><span class="error_agree error"></span>
</div>

And in the snippet call, we make it mandatory to fill in:
{$_modx->runSnippet('!AjaxForm', [
    'snippet' => 'FormIt',
    'hooks' => 'spam,email',
    'validate' => 'agree:required',
])}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question