HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


date picker for new Content Type?

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#106649 (In Topic #20791)
Avatar

Fan in training

always getting the value 1 with form_input_date

In my new file cms_service I'm doing this:

     $fields->attach(form_input_date(do_lang_tempcode('DATE_START'),'','date_start',false ,false, false, time()));

On submit I always get '1' for the value.
When I switch it to be a regular form_input_line, then it gets whatever value I put in.

    $fields->attach(form_input_line(do_lang_tempcode('DATE_START'),'','date_end',$date_end,false));

I looked at the add methods and it doesn't seem like I am putting in a 1 for the value. The fact that it works when I switch it to form_input_line seems to confirm that.

Wrong widget? Need more/different params? translate it like strval()?
BTW would INT(10) unsigned be the correct MySQL datatype for dates?


Thanks for any ideas! Hopefully I'll have a nice document to share at the end of this.:thumbs:
Back to the top
 
Posted
Rating:
#106650
Avatar

Hi,

You need get_input_date :).

It takes the multi-field inputs and turns it into a timestamp.

Btw, in v10 we will support both HTML5-style date inputs, and the multi-field inputs we currently use.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#106651
Avatar

As for data types, we use a meta system on top of our database support, so have 'TIME' as one of the possible fields. But you don't need to use it. Our TIME maps to an int, yeah. The actual length specifier does nothing much:
sqldatatypes - MySql: Tinyint (2) vs tinyint(1) - what is the difference? - Stack Overflow


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#106652
Avatar

Fan in training

Wizard! thanks Chris!

I bet if I get a better environment set up it will help get a better handle on the API with the code introspection etc. Ctrl+F is only getting me so far!
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: