[{"id":45,"parent_id":0,"title":"Distric Reload test Form","alias":"district_reload_test_form","created":"2025-02-24 10:01:57","published":1,"category":"","elements":{"1":{"id":"1","type":"page","minimized":"","title":"Page1","alias":"page1","pagegroup":"","icon":""},"59":{"id":"59","parent":"1","section":"load","name":"read_data","type":"actions","settings":{"disabled":"","name":"read_province_option","designer_label":"Province Option","designer_label_color":""},"dbtable":"anb_anybox_thailand_district","read_type":"all","behaviors":["read_data.fields","read_data.group_by","wizard_settings"],"fields":"province_thai=province_thai","group_by":["province_thai"]},"60":{"id":"60","parent":"1","section":"load","name":"read_data","type":"actions","settings":{"disabled":"","name":"read_district_option","designer_label":"District Option","designer_label_color":""},"dbtable":"anb_anybox_thailand_district","read_type":"all","behaviors":["read_data.fields","read_data.group_by","where_statement","wizard_settings"],"fields":"district_thai=district_thai","group_by":["district_thai"],"where":"province_thai=\"\u0e01\u0e23\u0e38\u0e07\u0e40\u0e17\u0e1e\u0e21\u0e2b\u0e32\u0e19\u0e04\u0e23\""},"9":{"id":"9","parent":"1","section":"load","name":"area_multi_field","type":"views"},"56":{"id":"56","parent":"9","section":"fields","name":"field_select","type":"views","label":"\u0e08\u0e31\u0e07\u0e2b\u0e27\u0e31\u0e14","fieldname":"sel_province","options":"","behaviors":["field_select.searchable","field_select.additions","dynamic_options","events_triggers","field_width","selected_values"],"dynamic_options":{"datasource":"{var:read_province_option}","value":"{row:province_thai}","text":"{row:province_thai}"},"triggers":{"1":{"condition":"change","name":["change_province"]}},"field_width":"300px","selected_values":["\u0e19\u0e19\u0e17\u0e1a\u0e38\u0e23\u0e35"]},"55":{"id":"55","parent":"9","section":"fields","name":"field_select","type":"views","label":"\u0e40\u0e02\u0e15 - \u0e2d\u0e33\u0e40\u0e20\u0e2d","fieldname":"customer_address_district","options":"","behaviors":["field_select.searchable","field_select.additions","dynamic_options","events_listeners","events_triggers","field_width"],"dynamic_options":{"datasource":"{var:read_district_option}","value":"{row:district_thai}","text":"{row:district_thai}"},"listeners2":{"1":{"trigger":["change_province"],"action":"load_options","params":["district_option"]}},"triggers":{"1":{"condition":"change","name":["district_change"]}},"field_width":"300px"},"66":{"id":"66","parent":"9","section":"fields","name":"field_select","type":"views","label":"\u0e41\u0e02\u0e27\u0e07 - \u0e15\u0e33\u0e1a\u0e25","fieldname":"customer_address_tambon","options":"","behaviors":["field_select.searchable","field_select.additions","events_listeners","field_width"],"listeners2":{"1":{"trigger":["district_change"],"action":"load_options","params":["tambon_option"]}},"field_width":"300px"},"48":{"id":"48","parent":"1","section":"submit","name":"save_data","type":"actions","settings":{"disabled":"","name":""},"dbtable":"anb_anybox_customer","datasource":"","behaviors":["data_override","events"],"data_override":"customer_name={data:customer_name}\r\ncustomer_category_id={data:customer_category}\r\ncustomer_address={data:customer_address}\r\ncustomer_address_tambon={data:customer_address_tambon}\r\ncustomer_address_district={data:customer_address_district}\r\ncustomer_address_province={data:customer_address_province}\r\ncustomer_post_address={data:customer_post_address}\r\ncustomer_branch={data:customer_branch}\r\ncustomer_branch_id={data:customer_branch_id}\r\ncustomer_tax_id={data:customer_tax_id}\r\ncustomer_phone_1={data:customer_phone_1}\r\ncustomer_phone_2={data:customer_phone_2}\r\ncustomer__fax={data:customer_fax}\r\ncustomer_contact_1={data:customer_contact_1}\r\ncustomer_contact_position_1={data:customer_contact_position_1}\r\ncustomer_mobile_1={data:customer_mobile_1}\r\ncustomer_email_1={data:customer_email_1}\r\ncustomer_contact_2={data:customer_contact_2}\r\ncustomer_contact_position_2={data:customer_contact_position_2}\r\ncustomer_mobile_2={data:customer_mobile_2}\r\ncustomer_email_2={data:customer_email_2}\r\ncustomer_credit_day={data:customer_credit_day}\r\ncustomer_remark={data:customer_remark}","events":["not_saved","saved"]},"51":{"id":"51","parent":"48","section":"not_saved","name":"html","type":"views","code":"<p>\u0e25\u0e07\u0e17\u0e30\u0e40\u0e1a\u0e35\u0e22\u0e19\u0e44\u0e21\u0e48\u0e2a\u0e33\u0e40\u0e23\u0e47\u0e08<\/p>"},"50":{"id":"50","parent":"48","section":"saved","name":"html","type":"views","code":"<p>\u0e25\u0e07\u0e17\u0e30\u0e40\u0e1a\u0e35\u0e22\u0e19\u0e2a\u0e33\u0e40\u0e23\u0e47\u0e08<\/p>"},"49":{"id":"49","parent":"1","section":"submit","name":"redirect","type":"actions","settings":{"disabled":"","name":""},"url":"https:\/\/anybox-packaging.com\/customer_system_menu\/customer-register?view=form","behaviors":["redirect.delay"],"delay":"3"},"58":{"id":"58","type":"page","minimized":"","title":"District Option","alias":"district_option","pagegroup":"ReloadDistrict","icon":""},"64":{"id":"64","parent":"58","section":"load","name":"php","type":"actions","settings":{"disabled":"","name":""},"code":"\/\/ return district from selected province\r\n\r\n\/\/ Import Joomla's database classes\r\nuse Joomla\\CMS\\Factory;\r\nuse Joomla\\CMS\\Table\\Table;\r\n\r\n\/\/ Get the database connection\r\n\/\/ $db = Factory::getDbo();\r\n\/\/ new Joomla5\r\n$db = Factory::getContainer()->get('DatabaseDriver');\r\n\r\n\/\/ Create a new query object\r\n$query = $db->getQuery(true);\r\n\r\n$prov = $this->data('sel_province');\r\n$search_column = 'district_thai';\r\n$order_type = ' ASC';\r\n\r\n$query->SELECT($db->quoteName($search_column))\r\n    ->FROM($db->quoteName('#__anybox_thailand_district'))\r\n    ->WHERE($db->quoteName('province_thai') . '= :province')\r\n    ->GROUP($db->quoteName('district_thai'))\r\n    ->ORDER($db->quoteName($search_column).$order_type)\r\n    ->bind(':province', $prov);\r\n\r\n$db->setQuery($query);\r\n$results = $db->loadAssocList();\r\n\r\n\r\n$district = array();\r\nforeach ($results as $x) {\r\n  $district[] = array('value'=>$x['district_thai'], 'text'=>$x['district_thai']);\r\n}\r\n echo json_encode($district, JSON_PRETTY_PRINT);\r\n\r\n\r\n"},"67":{"id":"67","type":"page","minimized":"","title":"Tambon option","alias":"tambon_option","pagegroup":"ReloadTambon","icon":""},"68":{"id":"68","parent":"67","section":"load","name":"php","type":"actions","settings":{"disabled":"","name":""},"code":"\/\/ return district from selected province\r\n\r\n\/\/ Import Joomla's database classes\r\nuse Joomla\\CMS\\Factory;\r\nuse Joomla\\CMS\\Table\\Table;\r\n\r\n\/\/ Get the database connection\r\n\/\/ $db = Factory::getDbo();\r\n\/\/ new Joomla5\r\n$db = Factory::getContainer()->get('DatabaseDriver');\r\n\r\n\/\/ Create a new query object\r\n$query = $db->getQuery(true);\r\n\r\n$dist = $this->data('customer_address_district');\r\n$search_column = 'tambon_thai';\r\n$order_type = ' ASC';\r\n\r\n$query->SELECT($db->quoteName($search_column));\r\n$query->FROM($db->quoteName('#__anybox_thailand_district'));\r\n$query->WHERE($db->quoteName('district_thai') . '= :district');\r\n$query->GROUP($db->quoteName($search_column));\r\n$query->ORDER($db->quoteName($search_column).$order_type);\r\n$query->bind(':district', $dist);\r\n\r\n$db->setQuery($query);\r\n$results = $db->loadAssocList();\r\n\r\n$tambon = array();\r\nforeach ($results as $x) {\r\n  $tambon[] = array('value'=>$x['tambon_thai'], 'text'=>$x['tambon_thai']);\r\n}\r\n echo json_encode($tambon, JSON_PRETTY_PRINT);\r\n\r\n\r\n"}},"params":{"log_data":"1","info":"","debug":"1","next_page":"1","navbar":"1","method":"post","ajax":"","action":"","class":"","css_vars":{"pad":"","space":"","rad":"","bw":""},"acl":"","acl_error":"You can not access this form.","session_token_error":"Your session has timed out or your tried to access a wrong page."}}]