V
V
Vladimir2017-06-21 12:49:59
MODX
Vladimir, 2017-06-21 12:49:59

How to handle checkbox in modx?

Hello.
The modx site has a Jot snippet for feedback. I add my checkbox to the chunk

<form method="post" action="[+form.action:esc+]#jf[+jot.link.id+]" class="review-form">
  <input name="JotForm" type="hidden" value="[+jot.id+]" />
  <input name="JotNow" type="hidden" value="[+jot.seed+]" />
  <input name="parent" type="hidden" value="[+form.field.parent+]" />
  
  [+form.moderation:is=`1`:then=`
    <div class="jot-row">
      <b>Created on:</b> [+form.field.createdon:date=`%a %B %d, %Y at %H:%M`+]<br />
      <b>Created by:</b> [+form.field.createdby:userinfo=`username`:ifempty=`[+jot.guestname+]`+]<br />
      <b>IP address:</b> [+form.field.secip+]<br />
      <b>Published:</b> [+form.field.published:select=`0=No&1=Yes`+]<br />
      [+form.field.publishedon:gt=`0`:then=`
        <b>Published on:</b> [+form.field.publishedon:date=`%a %B %d, %Y at %H:%M`+]<br />
        <b>Published by:</b> [+form.field.publishedby:userinfo=`username`:ifempty=` - `+]<br />
      `+]
      [+form.field.editedon:gt=`0`:then=`
        <b>Edited on:</b> [+form.field.editedon:date=`%a %B %d, %Y at %H:%M`+]<br />
        <b>Edited by:</b> [+form.field.editedby:userinfo=`username`:ifempty=` -`+]<br />
      `+]
    </div>
  `:strip+]
  
  [+form.guest:is=`1`:then=`
    <div class="review-form-field">
      <label for="name[+jot.id+]">Имя<span class="r_s">*</span></label>
      <input tabindex="[+jot.seed:math=`?+1`+]" class="form-control" name="name" type="text" size="40" value="[+form.field.custom.name:esc+]" id="name[+jot.id+]" />			
    </div>	
    <div class="review-form-field">
      <label for="email[+jot.id+]">E-mail</label>
      <input tabindex="[+jot.seed:math=`?+2`+]" class="form-control" name="email" type="text" size="40" value="[+form.field.custom.email:esc+]" id="email[+jot.id+]"/>
    </div>	
  `:strip+]
  <div class="review-form-field">
  <label for="content[+jot.id+]">Отзыв<span class="r_s">*</span></label>
  <textarea tabindex="[+jot.seed:math=`?+4`+]" name="content"  rows="10" cols="45" rows="10" cols="45" id="content[+jot.id+]">[+form.field.content:esc+]</textarea>
  </div>	
  [+jot.captcha:is=`1`:then=`
    <div>
    <label>Защита от автоматических сообщений</label>
    <a href="[+jot.link.current:esc+]"><img src="/manager//includes/veriword.php?rand=[+jot.seed+]" width="148" height="60" alt="Кликните для новой картинки"   class="captcha-img" /></a>
    </div>
    <div><label for="vericode[+jot.id+]">Введите слово на картинке<span class="r_s">*</span></label><input class="form-control" type="text" name="vericode" style="width:150px;" size="20" id="vericode[+jot.id+]" /></div>
  `:strip+]		
    <label class="calc-form-label">
                <input class="calc-form-checkbox" type="checkbox" name="checkbox" checked="" id="check" value="check2">
                Подписаться<span class="r_s">*</span>
    </label>
  <div class="review-form-field">
  <input tabindex="[+jot.seed:math=`?+5`+]" name="submit" type="submit" value="[+form.edit:is=`1`:then=`Save Comment`:else=`Отправить отзыв`+]" class="rewiew-btn" />
  [+form.edit:is=`1`:then=`
    <input tabindex="[+jot.seed:math=`?+5`+]" name="submit" type="submit" value="Отменить" class="rewiew-btn" onclick="history.go(-1);return false;" />
  `+] 
  </div>
</form>

Call:
[!Jot? &placeholders=`1` &output=`0` ¬ify='2' &tplForm='reviews_form' &tplComments='reviews_comment' &moderated='1' &captcha='1' &validate='checkbox:Review field is required!,name:Name field must be filled in!,content:The Feedback field must be filled in!' !]
In general, modx does not react to my checkbox in any way. What does it have value, what does it not. Doesn't matter.
Reacts only on input="text"

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