This repository has been archived by the owner. It is now read-only.

Allow media field to be disabled fully #1151

Merged
merged 1 commit into from Apr 17, 2012

Conversation

Projects
None yet
3 participants
@mbabker
Member

mbabker commented Apr 14, 2012

In either the form XML or in a model's getForm method (for those extending JModelForm), it is possible to set the disabled attribute on form fields. In trying to use this for some code I'm working on, I've found that in its current form, the media field cannot truly be disabled or read-only. In using $form->setFieldAttribute('logo', 'disabled', 'true'); in my model's getForm method, the Select and Clear buttons are still active and usable. So, for this field to be truly disabled, I've added a check for the disabled element prior to rendering the two buttons.

Use Case:
I'm using the same model in the back end to load a form with one of two layouts: the regular edit layout, and a "details" layout which loads the form data in basically a read-only state and adds a little more data to be viewed by the user.

eddieajau added a commit that referenced this pull request Apr 17, 2012

Merge pull request #1151 from mbabker/disableMedia
Allow media field to be disabled fully

@eddieajau eddieajau merged commit 8ef210c into joomla:staging Apr 17, 2012

@eddieajau

This comment has been minimized.

Show comment
Hide comment
@eddieajau

eddieajau Apr 17, 2012

Contributor

Merged. Thanks.

Contributor

eddieajau commented Apr 17, 2012

Merged. Thanks.

@benjaminpick benjaminpick referenced this pull request Apr 18, 2012

Merged

Show Media preview #1105

- $html[] = JText::_('JLIB_FORM_BUTTON_SELECT') . '</a>';
- $html[] = ' </div>';
- $html[] = '</div>';
+ if ($this->element['disabled'] != true)

This comment has been minimized.

@benjaminpick

benjaminpick May 4, 2012

This should be != 'true' (XML attribute values are still strings). For testing purposes, use disabled="false" as value - this currently disables the form element as well.

@benjaminpick

benjaminpick May 4, 2012

This should be != 'true' (XML attribute values are still strings). For testing purposes, use disabled="false" as value - this currently disables the form element as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.