Setting a default date value in form builder

73 views
Skip to first unread message

Simon Berry

unread,
Dec 29, 2015, 6:08:44 AM12/29/15
to commcare-users
In form builder I'm attempting to set a default date value of 1-Jan-2010 for a date field.

I've tried the following in the 'Default Data Value' field:
  1. 2010-01-01 does not give an error when building the form but doesn't work. I'm presented with today's date as the value to edit and not 2010-01-01
  2. date('2010-01-01') give the error: Invalid cast of data [date(2010-01-01)] to type Date in form Retailer details (new) in module "Retailers"
  3. date(2010-01-01) gives the same Invalid cast error as above
I've just checked Confluence and that tells me that functions aren't supported so I guess that's why item 2 and 3 give errors.

Help!

Simon

Clayton Sims

unread,
Dec 29, 2015, 11:10:00 AM12/29/15
to commcare-users
Simon,

Setting the value to the latter two elements would require using the "Default Value" field, rather than the "Default Data Value" field. I'm very surprised to hear that setting the Default Data Value to 2010-01-01 is not working, can you submit a bug from that form in CommCareHQ so we can take a look?

As a workaround, you can try using "Default Value" and one of the latter two expressions to see if that works.

-Clayton

--
You received this message because you are subscribed to the Google Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commcare-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simon Berry

unread,
Dec 29, 2015, 1:05:13 PM12/29/15
to commcare-users
Thanks. I have submitted a report from CommCareHQ as you suggest.

Regards

Simon
29/12/15



--
You received this message because you are subscribed to a topic in the Google Groups "commcare-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/commcare-users/Wb7LGKpKBRY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to commcare-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages