Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] how to save empty datepicker field as null

  • mduda
  • mduda
  • OFFLINE
  • Posts: 14
  • Thanks: 2
  • Karma: 0
8 years 4 months ago - 8 years 4 months ago #282835 by mduda
I have several datepicker fields in the registration form. When a user skips the field, it is automatically save as 0000-00-00 in the table. Is there a way to save it as null when the field is empty?
Last edit: 8 years 4 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
8 years 4 months ago - 8 years 4 months ago #282869 by krileon
Replied by krileon on topic how to save empty datepicker field as null
No, empty date fields will always store as 0000-00-00 and empty datetime fields will store as 0000-00-00 00:00:00. Why do you need it saved as null? We actually do not store null for any fieldtype except on initial user creation. Supporting null store is planned in a much later release of CB as we have to modify how we handle storing field values.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 8 years 4 months ago by krileon.

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

  • mduda
  • mduda
  • OFFLINE
  • Posts: 14
  • Thanks: 2
  • Karma: 0
8 years 4 months ago #282870 by mduda
Replied by mduda on topic how to save empty datepicker field as null
Gotcha. Thanks for the quick response! I found a work-around for my situation...I was loading the data from the table into a chronoform, and the datepicker in CF was getting a nan error. I just added code within the CF to convert the field to an empty string within the form.
The following user(s) said Thank You: krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum