From 820593b933c09424bd1646850a7441d60fd3ad47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cankush=5Fm=E2=80=9D?= Date: Thu, 28 Nov 2019 11:51:13 +0530 Subject: [PATCH] Bug #152905 fix: Front end>> Radio button under UCM sub form is not working properly --- site/helpers/tjfields.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/site/helpers/tjfields.php b/site/helpers/tjfields.php index 5c72b9a4..7de16977 100644 --- a/site/helpers/tjfields.php +++ b/site/helpers/tjfields.php @@ -483,7 +483,9 @@ private function saveSingleValuedFieldData($fieldValue, $client, $contentId, $fi } JLoader::import('components.com_tjfields.tables.fieldsvalue', JPATH_ADMINISTRATOR); + JLoader::import('components.com_tjfields.tables.option', JPATH_ADMINISTRATOR); $fieldsValueTable = JTable::getInstance('FieldsValue', 'TjfieldsTable', array('dbo', JFactory::getDbo())); + $fieldOptionTable = JTable::getInstance('Option', 'TjfieldsTable', array('dbo', JFactory::getDbo())); // Set currently logged in users id as user_id $fieldsValueTable->user_id = JFactory::getUser()->id; @@ -497,6 +499,12 @@ private function saveSingleValuedFieldData($fieldValue, $client, $contentId, $fi if ($fieldValue != '') { $fieldsValueTable->value = $fieldValue; + $fieldOptionTable->load(array('field_id' => $fieldId, 'value' => $fieldValue)); + + if ($fieldOptionTable->id) + { + $fieldsValueTable->option_id = $fieldOptionTable->id; + } if ($fieldsValueTable->store()) { @@ -519,6 +527,13 @@ private function saveSingleValuedFieldData($fieldValue, $client, $contentId, $fi $fieldsValueTable->value = $fieldValue; $fieldsValueTable->client = $client; + $fieldOptionTable->load(array('field_id' => $fieldId, 'value' => $fieldValue)); + + if ($fieldOptionTable->id) + { + $fieldsValueTable->option_id = $fieldOptionTable->id; + } + if ($fieldsValueTable->store()) { return true;