{"id":3077,"date":"2020-06-19T10:49:53","date_gmt":"2020-06-19T08:49:53","guid":{"rendered":"https:\/\/da-software.net\/?p=3077"},"modified":"2020-06-19T10:49:53","modified_gmt":"2020-06-19T08:49:53","slug":"dependent-calendar-fields-in-da-formmaker","status":"publish","type":"post","link":"https:\/\/da-software.net\/en\/2020\/06\/dependent-calendar-fields-in-da-formmaker\/","title":{"rendered":"Dependent calendar fields in DA-FormMaker"},"content":{"rendered":"<p>The following scenario: two calendar fields. If the user selects a date in the first field, the second calendar field should be automatically set to this date.<\/p>\n<p><!--more--><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2020\/06\/cal_1.png\" alt=\"\" width=\"529\" height=\"422\" class=\"aligncenter size-full wp-image-3071\" srcset=\"\/wp-content\/uploads\/2020\/06\/cal_1.png 529w, \/wp-content\/uploads\/2020\/06\/cal_1-300x239.png 300w\" sizes=\"auto, (max-width: 529px) 100vw, 529px\" \/><\/p>\n<p>With the following code the second calendar field can be synchronized with the first one:<\/p>\n<pre>\r\n$('#Cal1').change(function(){\r\n     $(\"#Cal2\").datepicker(\"option\", \"defaultDate\", $(\"#Cal1\").datepicker('getDate'))\r\n});\r\n<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2020\/06\/cal_2.png\" alt=\"\" width=\"600\" height=\"426\" class=\"aligncenter size-full wp-image-3073\" srcset=\"\/wp-content\/uploads\/2020\/06\/cal_2.png 600w, \/wp-content\/uploads\/2020\/06\/cal_2-300x213.png 300w, \/wp-content\/uploads\/2020\/06\/cal_2-90x65.png 90w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>&#8220;Cal1&#8221; and &#8220;Cal2&#8221; are the names of the two fields. These must be set accordingly in the code.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2020\/06\/caltest.zip\">Download the example<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>The following scenario: two calendar fields. If the user selects a date in the first field, the second calendar field<\/p>\n","protected":false},"author":1,"featured_media":662,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[20],"tags":[],"class_list":["post-3077","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips-and-tricks"],"_links":{"self":[{"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/posts\/3077","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/comments?post=3077"}],"version-history":[{"count":0,"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/posts\/3077\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/media\/662"}],"wp:attachment":[{"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/media?parent=3077"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/categories?post=3077"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/tags?post=3077"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}