@@ -973,7 +973,7 @@ function change_tag_type() {
973973 echo '<div id="tag_specific_value" style="display: none"> ' ;
974974
975975 $ result = $ DB ->request ([
976- 'SELECT ' => ['name ' ],
976+ 'SELECT ' => ['id ' , ' name ' ],
977977 'FROM ' => PluginTagTag::getTable (),
978978 'WHERE ' => [
979979 'AND ' => [
@@ -1843,15 +1843,25 @@ protected function saveTags(PluginFormcreatorFormanswer $formanswer, $targetId)
18431843 $ formAnswerFk = PluginFormcreatorFormAnswer::getForeignKeyField ();
18441844 $ questionFk = PluginFormcreatorQuestion::getForeignKeyField ();
18451845 $ result = $ DB ->request ([
1846- 'SELECT ' => ['answer ' ],
1846+ 'SELECT ' => ['plugin_formcreator_questions_id ' , ' answer ' ],
18471847 'FROM ' => PluginFormcreatorAnswer::getTable (),
18481848 'WHERE ' => [
18491849 $ formAnswerFk => [(int ) $ formanswer ->fields ['id ' ]],
18501850 $ questionFk => $ this ->fields ['tag_questions ' ]
18511851 ],
18521852 ]);
18531853 foreach ($ result as $ line ) {
1854- $ tab = json_decode ($ line ['answer ' ]);
1854+ $ question = new PluginFormcreatorQuestion ();
1855+ $ question ->getFromDB ($ line ['plugin_formcreator_questions_id ' ]);
1856+ $ field = PluginFormcreatorFields::getFieldInstance (
1857+ $ question ->fields ['fieldtype ' ],
1858+ $ question
1859+ );
1860+ $ field ->deserializeValue ($ line ['answer ' ]);
1861+ $ tab = $ field ->getRawValue ();
1862+ if (is_integer ($ tab )) {
1863+ $ tab = [$ tab ];
1864+ }
18551865 if (is_array ($ tab )) {
18561866 $ tags = array_merge ($ tags , $ tab );
18571867 }
0 commit comments