Page 1 of 1

Custom Form | Invalid Month Value: '0'

PostPosted: Wed Sep 25, 2019 6:08 am
by IanGP
VERSION: 2.14-697a
BUILD: 190121-2019

Hi,
We have picked up an interesting problem on one of our Custom Forms:
When clicking on the calendar, we get an error:
Invalid Month Value: '0'
Allowed range is 01-12


And the reason we get this is because the value in the field is 0000-00-00
Once we edit that to 2019-09-25, all good.

So question is why is 0000-00-00 being populated?
According to the manual:
DATE field types: the default is always set to today unless a number is put in in which case the date will be that many days plus or minus today.


This is happening on leads coming in via API. And we don't write to custom form on this campaign.

TIA
IanGP

Re: Custom Form | Invalid Month Value: '0'

PostPosted: Wed Sep 25, 2019 8:11 am
by mflorell
Have you tried populating the date in the API requests that you send?

Re: Custom Form | Invalid Month Value: '0'

PostPosted: Wed Sep 25, 2019 11:12 am
by IanGP
Hi Matt,
It's not something we can easily change, as we rely on the lead provider (and their change control processes) to change that string.
One thing I tried was set the default value in the custom form, to 2019-01-01, but no change.
Thanks
IanGP

Re: Custom Form | Invalid Month Value: '0'

PostPosted: Wed Sep 25, 2019 3:43 pm
by mflorell
I was just asking for you to test that, not make the change with your lead providers. That would confirm if it is an API issue or not.

Re: Custom Form | Invalid Month Value: '0'

PostPosted: Sat Sep 28, 2019 6:10 am
by blackbird2306
I can provide you an interim solution to work round the error until you have an appropriate solution. This error comes from "calendar_db.js" file, where a control routine checks the right format of your date. You can bypass this with a small change. Look into the calendar_db.js file in "/srv/www/htdocs/vicidial" (admin part) and "/srv/www/htdocs/agc" (agent part):

change line 26 from:
if (n_month < 1 || n_month > 12)

to:
if (n_month < 0 || n_month > 12)

Try it out, because I didn't search in the code for further date format checks (e.g. in php part)!