J3 Issue ?
avatar chinphing5
chinphing5
20 Aug 2019

Steps to reproduce the issue

I tried to override value of 'input' in view code like this.
$field->input = '<my input code>';

but the result in html was not changed. (same as before overridden)

Expected result

The input code is changed to new value.

Actual result

The code is not changed. And this line is shown in log file.

2019-08-16T12:36:56+00:00 INFO ::1 - Cannot access protected / private property input of Joomla\CMS\Form\FormField

System information (as much as possible)

Joomla 3.9.8

Additional comments

avatar chinphing5 chinphing5 - open - 20 Aug 2019
avatar joomla-cms-bot joomla-cms-bot - change - 20 Aug 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 20 Aug 2019
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 20 Aug 2019

can you please update on latest version?

avatar franz-wohlkoenig franz-wohlkoenig - change - 20 Aug 2019
Labels Added: J3 Issue
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 20 Aug 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 20 Aug 2019
Status New Information Required
avatar chinphing5
chinphing5 - comment - 20 Aug 2019

Thankyou @franz-wohlkoenig. I will update Joomla to the latest version.

Another update, I try to look inside the method '__set' of FormField class (parent class of JFormFieldText). The 'input' property does not appear in switch case. So it means that the input property should not be set directly?

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 20 Aug 2019

i'm no dev, but sure a dev. will answer :-)

avatar HLeithner
HLeithner - comment - 20 Aug 2019

It's not intended to set the input directly because most of the formfields building the input on the fly using the getInput method and render a layout.

avatar franz-wohlkoenig franz-wohlkoenig - change - 20 Aug 2019
Title
The property 'input' of JFormFieldText cannot be set.
The property 'input' of JFormFieldText cannot be set
avatar franz-wohlkoenig franz-wohlkoenig - edited - 20 Aug 2019
avatar chinphing5
chinphing5 - comment - 20 Aug 2019

Thankyou @HLeithner, I override the attribute of input html element via the other property of JFormFieldText such as $field->class and call renderField method. It works. The input html element is changed as my expectation.

avatar chinphing5 chinphing5 - change - 20 Aug 2019
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2019-08-20 19:09:09
Closed_By chinphing5
avatar chinphing5 chinphing5 - close - 20 Aug 2019

Add a Comment

Login with GitHub to post a comment