? Success

User tests: Successful: Unsuccessful:

avatar mhehm
mhehm
23 Dec 2013

calendar field do not disabled or readonly when in edit form fields xml, we add readonly or disabled attributes.

avatar mhehm mhehm - open - 23 Dec 2013
avatar Bakual
Bakual - comment - 23 Dec 2013

Can you have a look at this PR: #2531
It should solve this isse as well.

avatar mhehm
mhehm - comment - 23 Dec 2013

hi,
yes your pr fix this too. but i think if you fix this issue like mine, it is better, because some developers use readonly="true" or disabled="true". this is popular for all fields. but in your PR developer must use readonly="readonly" or disabled="disabled".

avatar Bakual
Bakual - comment - 23 Dec 2013

True, but yours would set them to true as soon as you set the parameter. Even if you set it to 0 or false.

I think I didn't change that part in my PR. Something like
$readonly = isset($attribs['readonly']) && $attribs['readonly'];
would make more sense imho then.

avatar mhehm
mhehm - comment - 23 Dec 2013

yes, it is.

avatar Bakual
Bakual - comment - 23 Dec 2013

Do you want to adjust your PR or shall I update mine? Since I didn't change that part in my PR, you can do it as your own and get proper credits.

avatar mhehm
mhehm - comment - 23 Dec 2013

No problem. you do it to complete your PR. and i will close my PR and link to your PR.

avatar Bakual
Bakual - comment - 23 Dec 2013

Actually, looking at it again, the formfield will work with readonly=true (in fact, that's what we use in core) with my PR.
The only place you need the attribute['required'] to be set to 'required' is when you use JHtml::_('calendar') directly. We only use that in com_banners in the tracks view, but without disabled or readonly attributes.

Thus I think it will be better if you update your PR and also change title and test instructions on how to test this change.

avatar mhehm mhehm - change - 24 Dec 2013
Labels Added: ? ?
avatar mhehm
mhehm - comment - 24 Dec 2013

I tested with #2531 pr and yes, it work with readonly="true" in forms. then with your fix, it work correctly.
one test & one question for directly use of JHtml::('calendar') with readonly attributes without patch my PR.
test: in file administrator/components/om
banners/views/tracks/tmpl/default.php line 52
change array('size' => 10, 'onchange' => "this.form.fireEvent('submit');this.form.submit()")
to : array('size' => 10, 'onchange' => "this.form.fireEvent('submit');this.form.submit()", 'readonly' => true)
now check track view of com_banners. Begin date is readonly. How it is possible when in calender function it check that $attribs['readonly'] == 'readonly'

avatar Bakual
Bakual - comment - 24 Dec 2013

Ha! That's indeed an interesting one :smile:
We're comparing a boolean value true to a string readonly which always evaluates true if we use ==. This is because non-empty strings are considered as true.

avatar mhehm
mhehm - comment - 24 Dec 2013

then if apply your pr, we do not need my pr

avatar Bakual
Bakual - comment - 24 Dec 2013

I think I found why it's done this way. The attributes are used directly as attributes for the HTML output of the field.
That means if you want valid HTML you need the attribute to be readonly="readonly". So we have in fact a bug, but a different one, because the comparision should probably be strict with === instead of == :smile:

avatar brianteeman brianteeman - change - 21 Aug 2014
Status New Pending
avatar nicksavov nicksavov - change - 21 Aug 2014
Labels Removed: ?
avatar brianteeman brianteeman - change - 27 Feb 2015
Status Pending Information Required
avatar roland-d
roland-d - comment - 27 Feb 2015

@mhehm Since PR #2531 is committed, do we still need yours?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/2720.
avatar brianteeman
brianteeman - comment - 30 Mar 2015

After one month without further reply I am closing this, it can always be reopened if needed


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/2720.
avatar brianteeman brianteeman - change - 30 Mar 2015
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2015-03-30 21:17:15
Closed_By brianteeman
avatar brianteeman brianteeman - change - 30 Mar 2015
Closed_Date 2015-03-30 21:17:15 2015-03-30 21:17:16
avatar brianteeman brianteeman - close - 30 Mar 2015

Add a Comment

Login with GitHub to post a comment