{"id":1020013,"date":"2015-10-29T12:59:58","date_gmt":"2015-10-29T19:59:58","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/required-fields-error-messages\/"},"modified":"2015-10-30T11:21:26","modified_gmt":"2015-10-30T18:21:26","slug":"required-fields-error-messages","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/required-fields-error-messages\/","title":{"rendered":"Required Fields Error Messages"},"content":{"rendered":"<p>Hi. I had previously made note of the fact that the <a href=\"https:\/\/theeventscalendar.com\/knowledgebase\/required-fields-for-events-submission-form\/\">Required Fields for Event Submission Form<\/a> guide is outdated and unfortunately has some bugs in the code offered, but wanted to share that here in case the responding rep was not aware of those issues.<\/p>\n<p>With that said, until the guide is fixed, I was hoping you could provide some guidance with how we can:<br \/>\n1) Change the default error message that is returned to users when a required field is missing (for example, change &#8220;Tax Input is required&#8221; to &#8220;Event Category is required&#8221;)<br \/>\n2) How we can add a Custom Error Message at the top of the page when errors are returned to the user. Would it be possible to give an example of what we should replace &#8220;$some_condition&#8221; with (if this bit of code from the afformentioned guide is still valid)?<\/p>\n<pre><code>add_filter( &#039;tribe_community_events_form_errors&#039;, &#039;ce_custom_error_msg&#039; );\n \nfunction ce_custom_error_msg( $errors ) {\n    if ( ! isset( $some_condition ) ) return $errors;\n \n    $existing_errors = &#039;&#039;;\n    $type = &#039;error&#039;;\n \n    if ( is_array( $errors ) ) {\n        $existing_errors = $errors[0][&#039;message&#039;];\n        $type = $errors[0][&#039;type&#039;];\n    }\n \n    $errors[0] = array(\n        &#039;type&#039; =&gt; $type,\n        &#039;message&#039; =&gt; &#039;&lt;h5&gt;You did not do something critical&lt;\/h5&gt;&#039; . $existing_errors\n    );\n \n    return $errors;\n}<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-1020013","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Required Fields Error Messages -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/required-fields-error-messages\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Required Fields Error Messages -\" \/>\n<meta property=\"og:description\" content=\"Hi. I had previously made note of the fact that the Required Fields for Event Submission Form guide is outdated and unfortunately has some bugs in the code offered, but wanted to share that here in case the responding rep was not aware of those issues. With that said, until the guide is fixed, I [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/required-fields-error-messages\/\" \/>\n<meta property=\"article:modified_time\" content=\"2015-10-30T18:21:26+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/required-fields-error-messages\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/required-fields-error-messages\/\",\"name\":\"Required Fields Error Messages -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2015-10-29T19:59:58+00:00\",\"dateModified\":\"2015-10-30T18:21:26+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/required-fields-error-messages\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/required-fields-error-messages\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/required-fields-error-messages\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Community Events\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/community-events\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Required Fields Error Messages\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Required Fields Error Messages -","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:\/\/theeventscalendar.com\/support\/forums\/topic\/required-fields-error-messages\/","og_locale":"en_US","og_type":"article","og_title":"Required Fields Error Messages -","og_description":"Hi. I had previously made note of the fact that the Required Fields for Event Submission Form guide is outdated and unfortunately has some bugs in the code offered, but wanted to share that here in case the responding rep was not aware of those issues. With that said, until the guide is fixed, I [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/required-fields-error-messages\/","article_modified_time":"2015-10-30T18:21:26+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/required-fields-error-messages\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/required-fields-error-messages\/","name":"Required Fields Error Messages -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2015-10-29T19:59:58+00:00","dateModified":"2015-10-30T18:21:26+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/required-fields-error-messages\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/required-fields-error-messages\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/required-fields-error-messages\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Community Events","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/community-events\/"},{"@type":"ListItem","position":5,"name":"Required Fields Error Messages"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1020013","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1020013\/revisions"}],"predecessor-version":[{"id":1020092,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1020013\/revisions\/1020092"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1020013"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}