Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

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

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

default Value for bool doesn´t work correctly.

Default Value: 1 -> Works
Default Value 0 -> Didn´t work
The following user(s) said Thank You: Tomaselli

Please Log in or Create an account to join the conversation.

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

I have the same error.

Please Log in or Create an account to join the conversation.

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

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

Please Log in or Create an account to join the conversation.

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

  • devil
  • devil's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 15
  • Thank you received: 2

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'
												));
				?>
The following user(s) said Thank You: VeCrea

Please Log in or Create an account to join the conversation.

Last edit: by devil.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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 following user(s) said Thank You: VeCrea

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.063 seconds

The j-cook project is one of the best of its kind and it is nice that we all try to contribute in little ways to make life easy for each other.

vlemos (Forum)  

Get Started