? ? Success

User tests: Successful: Unsuccessful:

avatar itbra
itbra
14 Oct 2014

i found JForm::setFieldAttribute method to not evaluate if passed in values for a specific attribute shall be merged into existing values or instead replace them, which forces one to write longer setFieldAttribute() statements just not to loose existing values. For example:

$form->setFieldAttribute(
    'description',
    'labelclass',
    $form->getFieldAttribute('description', 'labelclass', '', 'params') . '
    new1 new2 new3 ...',
    'params'
);

Note the 3rd param. This is pretty long, isn't it? And since it is not always only one single attribute that might be passed in, this param might become much longer. Wouldn't you agree that it is much easier to write:

$form->setFieldAttribute(
    'description',
    'labelclass',
    'new1 new2 new3 ...',
    'params'
);

We can easily shorten it by changing the related JForm method to evaluate this circumstance and either merge or replace the related attribute.

There already is an entry at the joomlacode bug tracker along with detailed testing instructions.

avatar itbra itbra - open - 14 Oct 2014
avatar itbra itbra - change - 14 Oct 2014
Title
JForm::setFieldAttribute() to merge rather than replace
[#31493] JForm::setFieldAttribute() to merge rather than replace
avatar jissues-bot jissues-bot - change - 14 Oct 2014
Title
[#31493] JForm::setFieldAttribute() to merge rather than replace
JForm::setFieldAttribute() to merge rather than replace
Labels Added: ?
avatar jissues-bot jissues-bot - change - 14 Oct 2014
Title
JForm::setFieldAttribute() to merge rather than replace
[#31493] JForm::setFieldAttribute() to merge rather than replace
avatar infograf768 infograf768 - change - 15 Oct 2014
Labels Added: ?
avatar infograf768
infograf768 - comment - 15 Oct 2014

Same as #3143 ??

avatar itbra
itbra - comment - 15 Oct 2014

I'm afraid yes. My bad, sorry!

avatar itbra itbra - close - 15 Oct 2014
avatar itbra itbra - close - 15 Oct 2014
avatar itbra itbra - change - 15 Oct 2014
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2014-10-15 09:44:25
avatar itbra itbra - head_ref_deleted - 15 Oct 2014
avatar itbra itbra - head_ref_restored - 15 Oct 2014
avatar itbra itbra - head_ref_deleted - 15 Oct 2014

Add a Comment

Login with GitHub to post a comment