? Success

User tests: Successful: Unsuccessful:

avatar Achal-Aggarwal
Achal-Aggarwal
23 Feb 2014

if value attribute is present in the xml of a field it should be evaluated as its default value.
Check issue #3158

http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33325&start=0

avatar Achal-Aggarwal Achal-Aggarwal - open - 23 Feb 2014
avatar Achal-Aggarwal
Achal-Aggarwal - comment - 23 Feb 2014
avatar brianteeman brianteeman - change - 23 Feb 2014
Labels
avatar Bakual
Bakual - comment - 23 Feb 2014

Several questions:

  • Why the change to the default behavior in the FormField class? This could be a BC break depending what the extending class does with the default value. Imho, this isn't needed to adress the issue at hand.
  • Why removing the default value handling in the checkbox field? I know it doesn't work fine out of the box, but it may do if taken care properly outside of the form.
  • I didn't test it, but why the introduction of $this->checkedValue? Why not just use $value or $this->value here?

Always keep in mind that those formfields may be extended by 3rd party extensions. Any changes to the fields need to be backward compatible.

avatar Achal-Aggarwal
Achal-Aggarwal - comment - 23 Feb 2014

Why the change to the default behavior in the FormField class? This could be a BC break depending what the extending class does with the default value. Imho, this isn't needed to adress the issue at hand.

I introduced the default property in the generic field class. Checkout the commit just before I introduced https://github.com/joomla/joomla-cms/blob/6234151121a601d3659f2d4da9b2eab441699223/libraries/joomla/form/field.php

Why removing the default value handling in the checkbox field? I know it doesn't work fine out of the box, but it may do if taken care properly outside of the form.

If we consider the document http://docs.joomla.org/Checkbox_form_field_type and the code how it is implemented before https://github.com/joomla/joomla-cms/blob/6234151121a601d3659f2d4da9b2eab441699223/libraries/joomla/form/fields/checkbox.php#L46 then after this PR it will get rollbacked.

I didn't test it, but why the introduction of $this->checkedValue? Why not just use $value or $this->value here?

If developer wants to change the value of checkbox I mean value present in <field type="checkbox" value="foobar" default="1"/> then he can now do that by writing $field->checkedValue = "New Foo Bar";.
Since we have value as property with every form field and it never contains $element['value'] so I added checkedValue i.e. https://github.com/joomla/joomla-cms/pull/3167/files#diff-af68d51c5d6b15538c81b99ccd0dd1e6R42

If people have started using $this->default then we can add back but currently it is only used in checkbox. There is no harm in having default.

This time I specially added UT's to make sure that after refactorization checkbox field interface match up with doc.

avatar Achal-Aggarwal Achal-Aggarwal - change - 26 Feb 2014
Labels Added: ?
avatar nicksavov nicksavov - change - 21 Aug 2014
Labels
avatar brianteeman brianteeman - change - 21 Aug 2014
Status New Pending
avatar nicksavov nicksavov - change - 21 Aug 2014
Labels Removed: ?
avatar brianteeman brianteeman - change - 2 Sep 2014
Category Libraries
avatar brianteeman brianteeman - change - 21 Sep 2014
The description was changed
avatar jissues-bot jissues-bot - change - 17 Oct 2014
Title
Fix [#33325] Value doesn't evaluated as default
Value doesn't evaluated as default
avatar brianteeman brianteeman - change - 17 Oct 2014
The description was changed
Title
Fix [#33325] Value doesn't evaluated as default
Value doesn't evaluated as default
avatar RCheesley
RCheesley - comment - 18 Oct 2014

It would be helpful to have some test instructions - willing to test but there isn't any detail on what I'm actually looking for.

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

avatar roland-d
roland-d - comment - 27 Feb 2015

@Achal-Aggarwal Please provide test instructions otherwise your PR can't be tested.

avatar roland-d
roland-d - comment - 4 May 2015

As there has been no feedback I am going to close the issue. Feel free to re-open if you think the issue still exists. The checkbox issue (#2617) has recently been committed and will be in the 3.4.2 release. Thank you for your contribution.

avatar roland-d roland-d - change - 4 May 2015
Title
Value doesn't evaluated as default
Value doesn't evaluated as default
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2015-05-04 16:53:56
Closed_By roland-d
avatar roland-d roland-d - change - 4 May 2015
Title
Value doesn't evaluated as default
[#33325] Value doesn't evaluated as default
avatar roland-d roland-d - close - 4 May 2015
avatar roland-d roland-d - close - 4 May 2015
avatar joomla-cms-bot joomla-cms-bot - change - 4 May 2015
Title
Value doesn't evaluated as default
[#33325] Value doesn't evaluated as default

Add a Comment

Login with GitHub to post a comment