Welcome, Guest
Username: Password: Remember me

TOPIC: [FIXED] Default Value not working correctly on bool

[FIXED] Default Value not working correctly on bool 08 Apr 2012 22:01 #1940

  • devil
  • devil's Avatar
  • Offline
  • New Member
  • Posts: 15
  • Thank you received: 2
  • Karma: 1
Hi,

default Value for bool doesn´t work correctly.

Default Value: 1 -> Works
Default Value 0 -> Didn´t work
The administrator has disabled public write access.
The following user(s) said Thank You: Tomaselli

Re: Default Value not working correctly on bool 09 Apr 2012 11:27 #1949

  • Tomaselli
  • Tomaselli's Avatar
  • Offline
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
I have the same error.
The administrator has disabled public write access.

Re: Default Value not working correctly on bool 09 Apr 2012 15:57 #1952

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
Same here, and i believe it could be useful for the authoring wizard to be able to set the published state to false.
The administrator has disabled public write access.
The following user(s) said Thank You: devil

Re: Default Value not working correctly on bool 10 Apr 2012 18:16 #1966

  • devil
  • devil's Avatar
  • Offline
  • New Member
  • Posts: 15
  • Thank you received: 2
  • Karma: 1
VeCrea wrote:
Same here, and i believe it could be useful for the authoring wizard to be able to set the published state to false.

Hi,

when you add this param to the bool array:
'dataValue' => '0'
Then it is set to unpublished.

Result:
<?php echo JDom::_('html.form.input.bool', array(
												'dataKey' => 'publish',
												'dataObject' => $this->event,
												'aclAccess' => 'core.edit.state',
												'required' => true,
                                                                                                'dataValue' => '0'
												));
				?>
Last Edit: 10 Apr 2012 18:17 by devil.
The administrator has disabled public write access.
The following user(s) said Thank You: VeCrea

Re: Default Value not working correctly on bool 11 Apr 2012 10:57 #1975

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Yes, I see.

If you don't specify any default value, false is choosen. But I will fix this issue.
'dataValue' => '0'
Wrong. If you do this you will have problems to edit your element and see it to true when it is to true.


The defaulting is twice :

TODO : If you want to modify the defaulting :
In the table file, in the check() method.
In the item model, in the _initData() method.

The difference is that the check() method is the last fallback test (absolutly secure because always called)
_initData() is for prefilling the item in the forms. (when id=0)
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: VeCrea
Time to create page: 0.090 seconds

Get Started