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

TOPIC:

[SOLVED] Default values 06 Oct 2011 12:58 #131

What is the value to specify for boolean data type ? true/false ? 1/0 ?
Can I specify a default value "today" for the date data type ?

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

Last edit: by admin.

Re: default values 06 Oct 2011 16:11 #135

I'm not sure if we can configure that, but my results are "0" as default value. We are facing basically the same issues.

What I did, after the component was generated, I changed the default values manually...
Paulo Griiettner

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

Re: default values 06 Oct 2011 16:33 #136

  • Kevin
  • Kevin's Avatar
  • Visitor
  • Visitor
The default values for the fields are only set after the form is saved.

They do not show up on the new form when it is being filled in.

If you set the default for the bool field to " 1 " (meaning yes) and it isn't set as a required field it will be stored in the database as 1 only if no one clicks it.

This is the same for other default values.
If you have a string or text field for someones name and you give it the default PETER then it won't show on the form but will be entered if the field is ignored.

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

Last edit: by Kevin. Reason: Typo

Re: default values 06 Oct 2011 17:19 #139

  • Kevin
  • Kevin's Avatar
  • Visitor
  • Visitor

zutiste wrote: Can I specify a default value "today" for the date data type ?


As for the default date value "Today"

Have you tried the wizards "Creation date" and "Modification date" for the tables.

I just gave them a go and they work great.

Just tell it to autogenerate the field for you and leave it at that.

You don't have to include it in your page it's a hidden field that it saved every time the table is saved and the dates are added for you.

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

Re: default values 07 Oct 2011 12:12 #158

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
I confirm, if you want to preset a form, fill the defaults values in the initData() method of the concerned model... or directly in the view or template. (depends the use)

The defaults values you specify in Cook are placed in the check() method of the table file.
By this way, whatever the method you use to create an item, the default is active.
Coding is now a piece of cake

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

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

Hi All just wanted to add one more "thank you" voice to all those who discovered the value of this amazing application. The website I was working on went to production few days ago and I do not want to even try to imagine what would it take to build it without j-cook. So - endless thanks keep it running and evolving I believe it deserves to be the core tool for any joomla application! Thanks!
Michael (bmk028 - Forum)  

Get Started