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.066 seconds

Awards for the best Joomla app. This product is gonna win an award for this amazing job. Cook Self Service is the the best application from all over the Joomla universe ! It brings Joomla to a professional level really advanced for developers. It is a real fun to develop with it. The ACL part and security checks implementation are just... so much hours saved. I can now concentrate myself more on the design part and the creative works. Thank you so much. Guys I offer you all my congratulation ! Keep up the works because Joomla is needing it to increase the quality of extensions availables on the JED. I also learned a lot because I can see how to code at the proper place and I found all my answers reading the forum.
lack_hanson (JED)
          

Get Started