{"id":5005,"date":"2018-08-03T11:19:45","date_gmt":"2018-08-03T15:19:45","guid":{"rendered":"https:\/\/themespress.ca\/?p=5005"},"modified":"2022-10-01T14:29:56","modified_gmt":"2022-10-01T18:29:56","slug":"default-value-formidable-form-drop-down","status":"publish","type":"post","link":"https:\/\/themespress.ca\/en\/default-value-formidable-form-drop-down\/","title":{"rendered":"Adding a Default Value in a Formidable Form field with Drop Down Menu"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><div class=\"vc_row wpb_row vc_row-fluid\"><div class=\"wpb_column vc_column_container vc_col-sm-12\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>With this tutorial, we will show you how to add a Selected text value in a drop down menu linked to a matching Posts or Post Type in a <a href=\"https:\/\/shareasale.com\/r.cfm?b=841990&amp;u=1476870&amp;m=64739&amp;urllink=&amp;afftrack=\" target=\"_blank\" rel=\"noopener\">Formidable Form<\/a>.<\/p>\n<p>In order to do so, we need a drop-down field in our form that we will call Countries for our example (it&#8217;s a type of taxonomy; you can name it fruits if you want). Do not add any choices manually.<\/p>\n<p>Save your form and then head to <strong>Settings &gt; Form actions<\/strong>.<\/p>\n<p>Then select <strong>Create a post<\/strong> (if that is not already done \u2013 This will create a post entry or post type matching your form parameters and fields included). Select the fields matching the post ou post type.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n\n\t<div  class=\"wpb_single_image wpb_content_element vc_align_left wpb_content_element\">\n\t\t\n\t\t<figure class=\"wpb_wrapper vc_figure\">\n\t\t\t<div class=\"vc_single_image-wrapper   vc_box_border_grey\"><img decoding=\"async\" width=\"1065\" height=\"226\" src=\"https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/Creer-une-publication.jpg\" class=\"vc_single_image-img attachment-full\" alt=\"\" title=\"Cr\u00e9er une publication dans Formidable Form\" srcset=\"https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/Creer-une-publication.jpg 1065w, https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/Creer-une-publication-600x127.jpg 600w, https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/Creer-une-publication-300x64.jpg 300w, https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/Creer-une-publication-1024x217.jpg 1024w, https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/Creer-une-publication-768x163.jpg 768w, https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/Creer-une-publication-1320x280.jpg 1320w\" sizes=\"(max-width: 1065px) 100vw, 1065px\" \/><\/div>\n\t\t<\/figure>\n\t<\/div>\n\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>For your taxonomy, go the <strong>Taxation\/Category<\/strong> section, then add your taoxnomy&#8217;s name and select the field you&#8217;ve created for your dynamic input of your taxonomy i.e. it will contain all choices added in the Select option from the Taxation\/Category section.<\/p>\n<p><strong>Here&#8217;s an example:<\/strong><\/p>\n\n\t\t<\/div>\n\t<\/div>\n\n\t<div  class=\"wpb_single_image wpb_content_element vc_align_left wpb_content_element\">\n\t\t\n\t\t<figure class=\"wpb_wrapper vc_figure\">\n\t\t\t<div class=\"vc_single_image-wrapper   vc_box_border_grey\"><img decoding=\"async\" width=\"890\" height=\"70\" src=\"https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/Ajouter-un-taxonomie-Formidable-Form.jpg\" class=\"vc_single_image-img attachment-full\" alt=\"\" title=\"Ajouter un taxonomie Formidable Form\" srcset=\"https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/Ajouter-un-taxonomie-Formidable-Form.jpg 890w, https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/Ajouter-un-taxonomie-Formidable-Form-600x47.jpg 600w, https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/Ajouter-un-taxonomie-Formidable-Form-300x24.jpg 300w, https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/Ajouter-un-taxonomie-Formidable-Form-768x60.jpg 768w, https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/Ajouter-un-taxonomie-Formidable-Form-1320x103.jpg 1320w\" sizes=\"(max-width: 890px) 100vw, 890px\" \/><\/div>\n\t\t<\/figure>\n\t<\/div>\n\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>The problem is that your <a href=\"https:\/\/shareasale.com\/r.cfm?b=841990&amp;u=1476870&amp;m=64739&amp;urllink=&amp;afftrack=\" target=\"_blank\" rel=\"noopener\">Formidable Form<\/a> does not give you a default value or first category in alphabetical order. So if you don&#8217;t want the field to look empty, you need to use the <strong>Formidable Form frm_dropdown_cat<\/strong> filter.<\/p>\n<p><strong>Here&#8217;s the filter:<\/strong><\/p>\n\n\t\t<\/div>\n\t<\/div>\n<h2 style=\"text-align: left;font-family:Abril Fatface;font-weight:400;font-style:normal\" class=\"vc_custom_heading vc_do_custom_heading\" >Adding a default value \u2013 Formidable Form drop-down taxonomy<\/h2>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>In this filter, you&#8217;ll notice that 139 is the ID of our drop down menu field. Simply replace it with your ID.<br \/>\n<strong>Add this filter in your theme&#8217;s functions.php file.<\/strong><\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div id=\"ts-enlighterjs-container-3156017\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-3156017\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"php\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">add_filter(&#039;frm_dropdown_cat&#039;, &#039;nomdevotrefonction&#039;, 10, 2);\nfunction nomdevotrefonction($args, $field){\n  if($field[&#039;id&#039;] == 139){ \/\/change 25 to the ID of your field\n    \/\/\/\/\/ Donner ici le nom htlm de votre texte\n    $args[&#039;show_option_all&#039;] = &#039;- S&eacute;lectionner -&#039;;\n  }\n  return $args;\n}<\/pre><\/div>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p><strong>Results:<\/strong><\/p>\n\n\t\t<\/div>\n\t<\/div>\n\n\t<div  class=\"wpb_single_image wpb_content_element vc_align_left wpb_content_element\">\n\t\t\n\t\t<figure class=\"wpb_wrapper vc_figure\">\n\t\t\t<div class=\"vc_single_image-wrapper   vc_box_border_grey\"><img decoding=\"async\" width=\"1018\" height=\"80\" src=\"https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/R\u00e9sultats-taxonomie-Formidable-Form.jpg\" class=\"vc_single_image-img attachment-full\" alt=\"\" title=\"R\u00e9sultats taxonomie Formidable Form\" srcset=\"https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/R\u00e9sultats-taxonomie-Formidable-Form.jpg 1018w, https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/R\u00e9sultats-taxonomie-Formidable-Form-600x47.jpg 600w, https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/R\u00e9sultats-taxonomie-Formidable-Form-300x24.jpg 300w, https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/R\u00e9sultats-taxonomie-Formidable-Form-768x60.jpg 768w, https:\/\/themespress.ca\/wp-content\/uploads\/2018\/08\/R\u00e9sultats-taxonomie-Formidable-Form-1320x103.jpg 1320w\" sizes=\"(max-width: 1018px) 100vw, 1018px\" \/><\/div>\n\t\t<\/figure>\n\t<\/div>\n<\/div><\/div><\/div><\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"With this tutorial, we will show you how to add a Selected text value in a drop down menu linked to a matching Posts or Post Type in a Formidable<div class=\"read-more\"><a class=\"btn button-secondary\" href=\"https:\/\/themespress.ca\/en\/default-value-formidable-form-drop-down\/\">Read More<\/a><\/div>","protected":false},"author":81,"featured_media":5008,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[283],"tags":[351,313],"class_list":["post-5005","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-forms","tag-plugins"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts\/5005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/users\/81"}],"replies":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/comments?post=5005"}],"version-history":[{"count":0,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts\/5005\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/media\/5008"}],"wp:attachment":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/media?parent=5005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/categories?post=5005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/tags?post=5005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}