{"id":8910,"date":"2026-08-21T10:26:02","date_gmt":"2026-08-21T10:26:02","guid":{"rendered":"https:\/\/studysection.com\/blog\/?p=8910"},"modified":"2026-08-21T10:26:46","modified_gmt":"2026-08-21T10:26:46","slug":"moodle-checkbox-validation-require-one-checkbox-selection","status":"publish","type":"post","link":"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/","title":{"rendered":"Moodle Checkbox Validation: Require One Checkbox Selection"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">When working with <a href=\"https:\/\/studysection.com\/blog\/how-to-create-and-download-a-csv-file-in-moodle-totara\/\" target=\"_blank\" rel=\"noopener\">Moodle<\/a> forms (mform), a common requirement is to ensure that at least one checkbox is selected from a group of options. Many developers try to use addRule() for this, but Totara\/Moodle does NOT support addRule() directly on checkbox groups.<\/span><\/p>\n<p><b>Why this problem happens<\/b><\/p>\n<p><span style=\"font-weight: 400;\">:Checkbox groups in Totara\/Moodle are stored as arrays. The addRule() method only works with single form elements, not grouped arrays. Because of this limitation, addRule() cannot validate that at least one checkbox is selected.<\/span><\/p>\n<h4><b>Example: Checkbox group<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Suppose we are creating a form where users must select <\/span><b>at least one cancellation reason<\/b><span style=\"font-weight: 400;\">. For this, we have a checkbox group named <\/span><b>cancellation_reasons<\/b><span style=\"font-weight: 400;\">:<\/span><\/p>\n<div style=\"background: black; color: white; padding: 12px; font-size: 15px;\">\n<p><span style=\"font-weight: 400;\">$reasons<\/span><span style=\"font-weight: 400;\"> = [];<\/span><span style=\"font-weight: 400;\">$reasons<\/span><span style=\"font-weight: 400;\">[] = <\/span><span style=\"font-weight: 400;\">$mform<\/span><span style=\"font-weight: 400;\">-&gt;<\/span><span style=\"font-weight: 400;\">createElement<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">&#8216;checkbox&#8217;<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">&#8216;cancellation_reasons[leave]&#8217;<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">&#8221;<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">&#8216;Leave&#8217;<\/span><span style=\"font-weight: 400;\">);<\/span><span style=\"font-weight: 400;\">$reasons<\/span><span style=\"font-weight: 400;\">[] = <\/span><span style=\"font-weight: 400;\">$mform<\/span><span style=\"font-weight: 400;\">-&gt;<\/span><span style=\"font-weight: 400;\">createElement<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">&#8216;checkbox&#8217;<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">&#8216;cancellation_reasons[equipment_delay]&#8217;<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">&#8221;<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">&#8216;Equipment Delay&#8217;<\/span><span style=\"font-weight: 400;\">);<\/span><span style=\"font-weight: 400;\">$reasons<\/span><span style=\"font-weight: 400;\">[] = <\/span><span style=\"font-weight: 400;\">$mform<\/span><span style=\"font-weight: 400;\">-&gt;<\/span><span style=\"font-weight: 400;\">createElement<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">&#8216;checkbox&#8217;<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">&#8216;cancellation_reasons[reschedule]&#8217;<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">&#8221;<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">&#8216;Reschedule&#8217;<\/span><span style=\"font-weight: 400;\">);<\/span><span style=\"font-weight: 400;\">$reasons<\/span><span style=\"font-weight: 400;\">[] = <\/span><span style=\"font-weight: 400;\">$mform<\/span><span style=\"font-weight: 400;\">-&gt;<\/span><span style=\"font-weight: 400;\">createElement<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">&#8216;checkbox&#8217;<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">&#8216;cancellation_reasons[other]&#8217;<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">&#8221;<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">&#8216;Other&#8217;<\/span><span style=\"font-weight: 400;\">);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">$mform<\/span><span style=\"font-weight: 400;\">-&gt;<\/span><span style=\"font-weight: 400;\">addGroup<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">$reasons<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">&#8216;cancellation_reasons&#8217;<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">&#8216;Cancellation Reasons&#8217;<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">html_writer<\/span><span style=\"font-weight: 400;\">::<\/span><span style=\"font-weight: 400;\">empty_tag<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">&#8216;br&#8217;<\/span><span style=\"font-weight: 400;\">),<\/span><span style=\"font-weight: 400;\">false<\/span><span style=\"font-weight: 400;\">);<\/span><\/p>\n<\/div>\n<p><span style=\"font-weight: 400;\">Now, when the form is submitted, the data will be sent like this:<\/span><\/p>\n<div style=\"background: black; color: white; padding: 12px; font-size: 15px;\">\n<p><span style=\"font-weight: 400;\">$data<\/span><span style=\"font-weight: 400;\">[<\/span><span style=\"font-weight: 400;\">&#8216;cancellation_reasons&#8217;<\/span><span style=\"font-weight: 400;\">] = [<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">&#8216;leave&#8217;<\/span><span style=\"font-weight: 400;\"> =&gt; <\/span><span style=\"font-weight: 400;\">1<\/span><span style=\"font-weight: 400;\">,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">&#8216;equipment_delay&#8217;<\/span><span style=\"font-weight: 400;\"> =&gt; <\/span><span style=\"font-weight: 400;\">0<\/span><span style=\"font-weight: 400;\">,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8230;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">];<\/span><\/p>\n<\/div>\n<p><span style=\"font-weight: 400;\">At this stage, the UI is complete, but the form will still submit even if <\/span><b>no checkbox is selected<\/b><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To enforce the \u201cat least one checkbox selected\u201d rule, we must override the <\/span><span style=\"font-weight: 400;\"><a href=\"https:\/\/blog.webnersolutions.com\/validation-vs-application-rules-in-cakephp\/\" target=\"_blank\" rel=\"noopener\">validation<\/a>()<\/span><span style=\"font-weight: 400;\"> method in the form class.<\/span><\/p>\n<div style=\"background: black; color: white; padding: 12px; font-size: 15px;\">\n<p><span style=\"font-weight: 400;\">\u00a0<\/span><span style=\"font-weight: 400;\">public<\/span> <span style=\"font-weight: 400;\">function<\/span> <span style=\"font-weight: 400;\">validation<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">$data<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">$files<\/span><span style=\"font-weight: 400;\">) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">$errors<\/span><span style=\"font-weight: 400;\"> = <\/span><span style=\"font-weight: 400;\">parent<\/span><span style=\"font-weight: 400;\">::<\/span><span style=\"font-weight: 400;\">validation<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">$data<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">$files<\/span><span style=\"font-weight: 400;\">);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">if<\/span><span style=\"font-weight: 400;\"> (<\/span><span style=\"font-weight: 400;\">empty<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">$data<\/span><span style=\"font-weight: 400;\">[<\/span><span style=\"font-weight: 400;\">&#8216;cancellation_reasons&#8217;<\/span><span style=\"font-weight: 400;\">]) ||<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0!<\/span><span style=\"font-weight: 400;\">array_filter<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">$data<\/span><span style=\"font-weight: 400;\">[<\/span><span style=\"font-weight: 400;\">&#8216;cancellation_reasons&#8217;<\/span><span style=\"font-weight: 400;\">])) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">$errors<\/span><span style=\"font-weight: 400;\">[<\/span><span style=\"font-weight: 400;\">&#8216;cancellation_reasons&#8217;<\/span><span style=\"font-weight: 400;\">] =<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">&#8216;Please select at least one cancellation reason.&#8217;<\/span><span style=\"font-weight: 400;\">;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">return<\/span> <span style=\"font-weight: 400;\">$errors<\/span><span style=\"font-weight: 400;\">;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<\/div>\n<p><span style=\"font-weight: 400;\">So, in the end, to validate group-level elements in Moodle, we need to use the validation() method rather than the addRule() method<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When working with Moodle forms (mform), a common requirement is to ensure that at least one checkbox is selected from<\/p>\n","protected":false},"author":1,"featured_media":8914,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,912],"tags":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Moodle Checkbox Validation: Require One Checkbox Selection - Blog Posts on famous people, innovations and educational topics<\/title>\n<meta name=\"description\" content=\"Moodle checkbox validation made simple. Learn how to require at least one checkbox selection using the validation() method in Moodle forms.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Moodle Checkbox Validation: Require One Checkbox Selection - Blog Posts on famous people, innovations and educational topics\" \/>\n<meta property=\"og:description\" content=\"Moodle checkbox validation made simple. Learn how to require at least one checkbox selection using the validation() method in Moodle forms.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog Posts on famous people, innovations and educational topics\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/studysection\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-21T10:26:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-08-21T10:26:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2026\/08\/Copy-of-Copy-of-Copy-of-How-to-Create-a-Custom-Report-Builder-Source-in-Totara-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"940\" \/>\n\t<meta property=\"og:image:height\" content=\"788\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin-studysection-blog\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@studysection\" \/>\n<meta name=\"twitter:site\" content=\"@studysection\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin-studysection-blog\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/\"},\"author\":{\"name\":\"admin-studysection-blog\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402\"},\"headline\":\"Moodle Checkbox Validation: Require One Checkbox Selection\",\"datePublished\":\"2026-08-21T10:26:02+00:00\",\"dateModified\":\"2026-08-21T10:26:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/\"},\"wordCount\":297,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/studysection.com\/blog\/#organization\"},\"articleSection\":[\"Learn and Grow\",\"Web Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/\",\"url\":\"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/\",\"name\":\"Moodle Checkbox Validation: Require One Checkbox Selection - Blog Posts on famous people, innovations and educational topics\",\"isPartOf\":{\"@id\":\"https:\/\/studysection.com\/blog\/#website\"},\"datePublished\":\"2026-08-21T10:26:02+00:00\",\"dateModified\":\"2026-08-21T10:26:46+00:00\",\"description\":\"Moodle checkbox validation made simple. Learn how to require at least one checkbox selection using the validation() method in Moodle forms.\",\"breadcrumb\":{\"@id\":\"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/studysection.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Moodle Checkbox Validation: Require One Checkbox Selection\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/studysection.com\/blog\/#website\",\"url\":\"https:\/\/studysection.com\/blog\/\",\"name\":\"Blog Posts on famous people, innovations and educational topics\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/studysection.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/studysection.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/studysection.com\/blog\/#organization\",\"name\":\"StudySection\",\"url\":\"https:\/\/studysection.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png\",\"contentUrl\":\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png\",\"width\":920,\"height\":440,\"caption\":\"StudySection\"},\"image\":{\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/studysection\",\"https:\/\/twitter.com\/studysection\",\"https:\/\/www.instagram.com\/study.section\/\",\"https:\/\/www.linkedin.com\/company\/studysection\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402\",\"name\":\"admin-studysection-blog\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g\",\"caption\":\"admin-studysection-blog\"},\"url\":\"https:\/\/studysection.com\/blog\/author\/admin-studysection-blog\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Moodle Checkbox Validation: Require One Checkbox Selection - Blog Posts on famous people, innovations and educational topics","description":"Moodle checkbox validation made simple. Learn how to require at least one checkbox selection using the validation() method in Moodle forms.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/","og_locale":"en_US","og_type":"article","og_title":"Moodle Checkbox Validation: Require One Checkbox Selection - Blog Posts on famous people, innovations and educational topics","og_description":"Moodle checkbox validation made simple. Learn how to require at least one checkbox selection using the validation() method in Moodle forms.","og_url":"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/","og_site_name":"Blog Posts on famous people, innovations and educational topics","article_publisher":"https:\/\/www.facebook.com\/studysection","article_published_time":"2026-08-21T10:26:02+00:00","article_modified_time":"2026-08-21T10:26:46+00:00","og_image":[{"width":940,"height":788,"url":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2026\/08\/Copy-of-Copy-of-Copy-of-How-to-Create-a-Custom-Report-Builder-Source-in-Totara-1.png","type":"image\/png"}],"author":"admin-studysection-blog","twitter_card":"summary_large_image","twitter_creator":"@studysection","twitter_site":"@studysection","twitter_misc":{"Written by":"admin-studysection-blog","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/#article","isPartOf":{"@id":"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/"},"author":{"name":"admin-studysection-blog","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402"},"headline":"Moodle Checkbox Validation: Require One Checkbox Selection","datePublished":"2026-08-21T10:26:02+00:00","dateModified":"2026-08-21T10:26:46+00:00","mainEntityOfPage":{"@id":"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/"},"wordCount":297,"commentCount":0,"publisher":{"@id":"https:\/\/studysection.com\/blog\/#organization"},"articleSection":["Learn and Grow","Web Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/","url":"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/","name":"Moodle Checkbox Validation: Require One Checkbox Selection - Blog Posts on famous people, innovations and educational topics","isPartOf":{"@id":"https:\/\/studysection.com\/blog\/#website"},"datePublished":"2026-08-21T10:26:02+00:00","dateModified":"2026-08-21T10:26:46+00:00","description":"Moodle checkbox validation made simple. Learn how to require at least one checkbox selection using the validation() method in Moodle forms.","breadcrumb":{"@id":"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/studysection.com\/blog\/moodle-checkbox-validation-require-one-checkbox-selection\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/studysection.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Moodle Checkbox Validation: Require One Checkbox Selection"}]},{"@type":"WebSite","@id":"https:\/\/studysection.com\/blog\/#website","url":"https:\/\/studysection.com\/blog\/","name":"Blog Posts on famous people, innovations and educational topics","description":"","publisher":{"@id":"https:\/\/studysection.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/studysection.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/studysection.com\/blog\/#organization","name":"StudySection","url":"https:\/\/studysection.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png","contentUrl":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png","width":920,"height":440,"caption":"StudySection"},"image":{"@id":"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/studysection","https:\/\/twitter.com\/studysection","https:\/\/www.instagram.com\/study.section\/","https:\/\/www.linkedin.com\/company\/studysection"]},{"@type":"Person","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402","name":"admin-studysection-blog","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g","caption":"admin-studysection-blog"},"url":"https:\/\/studysection.com\/blog\/author\/admin-studysection-blog\/"}]}},"views":6,"_links":{"self":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/8910"}],"collection":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/comments?post=8910"}],"version-history":[{"count":4,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/8910\/revisions"}],"predecessor-version":[{"id":8915,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/8910\/revisions\/8915"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/media\/8914"}],"wp:attachment":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/media?parent=8910"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/categories?post=8910"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/tags?post=8910"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}