?
avatar tgv604
tgv604
30 Jan 2017

There's a plugin that adds a bunch of user profile fields and also dynamically changes fields visibility depending on current layout (i.e. makes certain fields hidden on registration layout). After a recent upgrade the dynamically set "hidden" attribute stopped working the way it did.

Steps to reproduce the issue

  • Enable existing "profile" plugin,
  • within onContentPrepareForm() function, apply "hidden" attribute to some field, e.g.
$form->setFieldAttribute('dob', 'type', 'hidden', 'profile');

in my case, it's conditional

if ($form->getName() == 'com_users.registration') {
    $form->setFieldAttribute('dob', 'type', 'hidden', 'profile');
}

Expected result

a field would become hidden (on registration if conditional)

Actual result

it is still visible in case the field is received through iteration:

foreach ($this->form->getFieldsets() as $fieldset) { // Iterate through the form fieldsets and display each one.
	$fields = $this->form->getFieldset($fieldset->name);
...
	foreach ($fields as $field) {// Iterate through the fields in the set and display them.			
		if ($field->hidden) {
			echo $field->input;
		} else echo $field->renderField();
	}
}

But it is hidden if I add an extra step:

foreach ($this->form->getFieldsets() as $fieldset) { // Iterate through the form fieldsets and display each one.
	$fields = $this->form->getFieldset($fieldset->name);
...
	foreach ($fields as $f) {// Iterate through the fields in the set and display them.			
		$field = $this->form->getField($f->fieldname, $f->group);
		if ($field->hidden) {
			echo $field->input;
		} else echo $field->renderField();
	}
}

System information (as much as possible)

PHP 5.6.28

Additional comments

I believe the bug was introduced with J3.6.5 update

avatar tgv604 tgv604 - open - 30 Jan 2017
avatar joomla-cms-bot joomla-cms-bot - labeled - 30 Jan 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 5 Apr 2017

@tgv604 can you confirm this Issue in latest staging?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13807.

avatar joomla-cms-bot joomla-cms-bot - change - 5 Apr 2017
The description was changed
avatar joomla-cms-bot joomla-cms-bot - edited - 5 Apr 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 5 Apr 2017
The description was changed
Status New Information Required
avatar franz-wohlkoenig franz-wohlkoenig - change - 27 May 2017
The description was changed
Status Information Required Closed - No Reply
Closed_Date 0000-00-00 00:00:00 2017-05-27 10:32:02
Closed_By franz-wohlkoenig
avatar joomla-cms-bot joomla-cms-bot - close - 27 May 2017
avatar joomla-cms-bot
joomla-cms-bot - comment - 27 May 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 27 May 2017

This has been closed due to lack of response to the requests above – it can always be reopened in the future if it is updated.

Add a Comment

Login with GitHub to post a comment