Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is an example from a form I've done. </p> <pre><code>&lt;cfif isDefined("form.submit")&gt; &lt;cfif form.checkbox1a EQ "" &gt; &lt;p class="text-error"&gt;Please check at least one answer below&lt;/p&gt; &lt;/cfif&gt; &lt;/cfif&gt; &lt;fieldset data-role="controlgroup"&gt; &lt;legend&gt;*Pick some chips&lt;/legend&gt; &lt;input type="checkbox" name="checkbox1a" id="checkbox1a" value="a" &lt;cfif ListFind(form.checkbox1a,"a") GT 0&gt;checked="checked"&lt;/cfif&gt;/&gt; &lt;label for="checkbox1a"&gt;Cheetos&lt;/label&gt; &lt;input type="checkbox" name="checkbox1a" id="checkbox2a" value="b" &lt;cfif ListFind(form.checkbox1a,"b") GT 0&gt;checked="checked"&lt;/cfif&gt;/&gt; &lt;label for="checkbox2a"&gt;Doritos&lt;/label&gt; &lt;input type="checkbox" name="checkbox1a" id="checkbox3a" value="c" &lt;cfif ListFind(form.checkbox1a,"c") GT 0&gt;checked="checked"&lt;/cfif&gt;/&gt; &lt;label for="checkbox3a"&gt;Fritos&lt;/label&gt; &lt;input type="checkbox" name="checkbox1a" id="checkbox4a" value="d" &lt;cfif ListFind(form.checkbox1a,"d") GT 0&gt;checked="checked"&lt;/cfif&gt;/&gt; &lt;label for="checkbox4a"&gt;Sun Chips&lt;/label&gt; &lt;/fieldset&gt; </code></pre> <p>You must make sure your checkboxes have the same names, but different values. Then just make a check to see if that name has a value or not. I did mine before the checkboxes because I wanted the error message to appear above the boxes, but since the CF is only triggered on the form submit, it will execute second.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload