checkbox contact custom field Joomla 3.8.6

General questions relating to Joomla! 3.x. Please consider the availability of third-party templates and extensions when deciding which Joomla version to use.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Post Reply
synt_net
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Feb 08, 2018 4:18 pm

checkbox contact custom field Joomla 3.8.6

Post by synt_net » Fri Apr 13, 2018 3:34 pm

Hello,
in Joomla 3.8.6 when I create a checkbox contact custom field, in front end it show the value of checkbox instead of the text.
How can I resolve this issue?

Thanks in advance

synt_net
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Feb 08, 2018 4:18 pm

Re: checkbox contact custom field Joomla 3.8.6

Post by synt_net » Tue Apr 17, 2018 7:18 am

Nobody has the same problem?

synt_net
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Feb 08, 2018 4:18 pm

Re: checkbox contact custom field Joomla 3.8.6

Post by synt_net » Tue Apr 17, 2018 8:46 am

After a lot of search I found that modifing this file of the core of joomla "administrator/components/com_fields/libraries/fieldslistplugin.php" in this way:

Code: Select all

public function onCustomFieldsPrepareDom($field, DOMElement $parent, JForm $form)
        {
                $fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form);

                if (!$fieldNode)
                {
                        return $fieldNode;
                }

                $fieldNode->setAttribute('validate', 'options');

                foreach ($this->getOptionsFromField($field) as $value => $name)
                {


                        $option = new DOMElement('option', htmlspecialchars($value, ENT_COMPAT, 'UTF-8'));
-                        $option->textContent = htmlspecialchars(JText::_($name), ENT_COMPAT, 'UTF-8');
+                        $option->nodeValue = htmlspecialchars(JText::_($name), ENT_COMPAT, 'UTF-8');


                        $element = $fieldNode->appendChild($option);
                        $element->setAttribute('value', $value);
                }

                return $fieldNode;
        }
I resolved my problem.
I ask you if this change can give some problems to the cms.

Thanks in advance for answers

synt_net
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Feb 08, 2018 4:18 pm

Re: checkbox contact custom field Joomla 3.8.6

Post by synt_net » Wed Apr 18, 2018 8:53 am

I found the probelm was in the php version of my hosting.
$option->textContent it's work with php >= 5.6.1
For backward compatibility, we need to use $option->nodeValue

So I've update my php version and all works fine.


Post Reply

Return to “General Questions/New to Joomla! 3.x”