{"result":{"depiction_url":null,"edges":{"about":{"objects":[{"created":"2026-04-28T14:53:23Z","object_id":{"id":2512,"is_a":["text","documentation","reference","template_filter"],"name":"doc_template_filter_filter_translated_texts","title":"translated_texts","uri":"https:\/\/zotonic.com\/id\/2512"},"seq":1000000}],"predicate":{"id":300,"is_a":["meta","predicate"],"name":"about","title":{"_type":"trans","tr":{"nl":"Over","en":"About"}},"uri":"http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#about"}},"in_module":{"objects":[{"created":"2024-11-29T16:27:36Z","object_id":{"id":1331,"is_a":["text","documentation","reference","module"],"name":"doc_module_mod_admin","title":"mod_admin","uri":"https:\/\/zotonic.com\/id\/1331"},"seq":1000000}],"predicate":{"id":333,"is_a":["meta","predicate"],"name":"in_module","title":{"_type":"trans","tr":{"en":"In module"}},"uri":"https:\/\/zotonic.com\/id\/in_module"}},"references":{"objects":[{"created":"2024-11-29T16:27:36Z","object_id":{"id":1419,"is_a":["text","documentation","developerguide"],"name":"doc_developerguide_forms_and_validation","title":"Forms and validation","uri":"https:\/\/zotonic.com\/id\/1419"},"seq":1000000}],"predicate":{"id":332,"is_a":["meta","predicate"],"name":"references","title":{"_type":"trans","tr":{"en":"References"}},"uri":"https:\/\/zotonic.com\/id\/references"}},"subject":{"objects":[{"created":"2026-09-09T13:48:21Z","object_id":{"id":2555,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_reference","title":"Reference","uri":"https:\/\/zotonic.com\/id\/2555"},"seq":1},{"created":"2026-09-09T13:48:21Z","object_id":{"id":2563,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_frontend_developer","title":"Frontend developer","uri":"https:\/\/zotonic.com\/id\/2563"},"seq":2},{"created":"2026-09-09T13:48:21Z","object_id":{"id":2574,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_content_relationships","title":"Content relationships","uri":"https:\/\/zotonic.com\/id\/2574"},"seq":3},{"created":"2026-09-09T13:48:21Z","object_id":{"id":2617,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_edge","title":"Edge","uri":"https:\/\/zotonic.com\/id\/2617"},"seq":4},{"created":"2026-09-09T13:48:21Z","object_id":{"id":2622,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_template_validator","title":"Template validator","uri":"https:\/\/zotonic.com\/id\/2622"},"seq":5},{"created":"2026-09-09T13:48:21Z","object_id":{"id":2640,"is_a":["categorization","keyword","keyword_task"],"name":"zotonic_topic_validate","title":"Validate","uri":"https:\/\/zotonic.com\/id\/2640"},"seq":6}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":2423,"is_a":["text","documentation","reference","template_validator"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2423"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_template_validator_validator_hasedge","page_url":{"en":"https:\/\/zotonic.com\/docs\/2423\/hasedge","x-default":"https:\/\/zotonic.com\/docs\/2423\/hasedge"},"preview_url":null,"resource":{"version":53,"pivot_location_lat":null,"title":"hasedge","is_authoritative":true,"body":"<p>A <a href=\"\/id\/doc_developerguide_forms_and_validation#guide-validators\">validator<\/a> to check if a resource has a certain number\nof edges with a predicate.<\/p>\n<p>An example of its usage is an edit form where the article needs between 1 and 5 keywords and an author.<\/p>\n<p>It can be attached to any (hidden) input field or the form itself.<\/p>\n<p>An example to check the number of keywords attached to a resource:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-django\">&lt;div class=&quot;form-group&quot;&gt; &lt;!-- form-group has class &quot;has-error&quot; if validation fails --&gt;\n    &lt;input type=&quot;hidden&quot; id=&quot;check-author&quot; value=&quot;author&quot;&gt;\n    {% validate id=&quot;check-author&quot;\n                type={hasedge id=id minimum=1}\n                only_on_submit\n    %}\n    &lt;p class=&quot;if-has-error&quot; style=&quot;display: none&quot;&gt;{_ You must have at least one author. _}&lt;\/p&gt;\n    &lt;p class=&quot;if-has-validated&quot; style=&quot;display: none&quot;&gt;{_ Great, you added at least one author. _}&lt;\/p&gt;\n&lt;\/div&gt;\n<\/code><\/pre>\n<p>On form submit the check will be done. And either of the two messages will be shown. The predicate to be checked is the\nvalue of the hidden input element.<\/p>\n<p>The hidden input element is not submitted as it doesn’t have a name.<\/p>\n<h2>Arguments<\/h2>\n<table class=\"table\"><thead><tr><th>Argument<\/th><th>Description<\/th><th>Example<\/th><\/tr><\/thead><tbody><tr><td><code>id<\/code><\/td><td>Subject resource id for the edge check.<\/td><td><code>id<\/code><\/td><\/tr><tr><td><code>predicate<\/code><\/td><td>Predicate to check, defaults to the value of the input element the validator is connected to.<\/td><td><code>&quot;author&quot;<\/code><\/td><\/tr><tr><td><code>minimum<\/code><\/td><td>Minimum amount of edged allowed, defaults to 1.<\/td><td><code>2<\/code><\/td><\/tr><tr><td><code>maximum<\/code><\/td><td>Maximum amount of edged allowed, per default no maximum.<\/td><td><code>10<\/code><\/td><\/tr><\/tbody><\/table>","slug":"hasedge","is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"6fdf87d0a234fc2d2a865868db7029fc8a91497d6fa979555b6aaa34e0a7a0a5","is_featured":false,"content_group_id":{"id":2551,"is_a":["meta","content_group"],"name":"content_group_imported_docs","title":"Imported documentation","uri":"https:\/\/zotonic.com\/id\/content_group_imported_docs"},"category_id":{"id":328,"is_a":["meta","category"],"name":"template_validator","title":"Validators","uri":"https:\/\/test.zotonic.com\/id\/328"},"doc_source_path":"apps\/zotonic_mod_admin\/src\/validators\/validator_admin_hasedge.erl","publication_start":"2024-11-29T16:27:36Z","github_url":"https:\/\/github.com\/zotonic\/zotonic\/blob\/master\/apps\/zotonic_mod_admin\/src\/validators\/validator_admin_hasedge.erl","pivot_location_lng":null,"doc_source_kind":"validator","name":"doc_template_validator_validator_hasedge","is_unfindable":false,"is_published":true,"pivot_geocode":null,"created":"2024-11-29T16:27:36Z","uri":null,"doc_status":"current","is_dependent":false,"erlang_app":"zotonic_mod_admin","publication_end":"9999-06-01T00:00:00Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"privacy":0,"doc_source_commit":"66cb145eae7002b184e7d8c4c7bba5e53e8248e5\n","erlang_module":"validator_admin_hasedge","creator_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"modified":"2026-10-02T12:40:42Z","title_slug":"hasedge"},"uri":"https:\/\/zotonic.com\/id\/2423","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2423"}},"status":"ok"}