Page 1 of 1

How to cancle the drop-down for date?

Posted: 28 Feb 2019, 06:37
by Smile Tan
I want to input date in format of YYYY/MM/DD. But now it's a drop-down menu. How I can adjust it?
Snipaste_2019-02-28_14-34-35.png
Snipaste_2019-02-28_14-34-35.png (14.17 KiB) Viewed 7664 times
Snipaste_2019-02-28_14-34-35.png
Snipaste_2019-02-28_14-34-35.png (14.17 KiB) Viewed 7664 times

Re: How to cancle the drop-down for date?

Posted: 28 Feb 2019, 09:21
by cas
I suppose you are refering to a custom field?
Then you would need to make it a string field and use the regular expreion field to ensure correct format

Re: How to cancle the drop-down for date?

Posted: 26 Jul 2019, 09:23
by Smile Tan
cas wrote: 28 Feb 2019, 09:21 I suppose you are refering to a custom field?
Then you would need to make it a string field and use the regular expreion field to ensure correct format
You are correct, I am refering to a custom date field.
As you said, string type can solve my question? let me try.

Re: How to cancle the drop-down for date?

Posted: 26 Jul 2019, 09:46
by Smile Tan
cas wrote: 28 Feb 2019, 09:21 I suppose you are refering to a custom field?
Then you would need to make it a string field and use the regular expreion field to ensure correct format
Now I configure it as a string field and configure the regular experion as below: ^(?:(?!0000)[0-9]{4}([-]?)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)([-]?)0?2\2(?:29))$
It's working normally.
At the same time, do you know some plugins to configure the date as a drop down selection box as attached?
20190726_174407.png
20190726_174407.png (294.71 KiB) Viewed 7312 times

Re: How to cancle the drop-down for date?

Posted: 26 Jul 2019, 10:18
by cas
There are several java scripts available but difficult to activate for custom field.
So you would need to create a plugin for the purpose you are now using a custom field.
Then of course you can make use of such java script

Re: How to cancle the drop-down for date?

Posted: 11 Oct 2019, 17:28
by TerranceM
function pad(n){return n<10 ? '0'+n : n}
var date = new Date();
var selectElement = $('<select>'), optionElement;
for (var count =0; count < 90; count++){
date.setDate(date.getDate() + 1);
formattedDate = pad(date.getUTCDate()) + '-' + pad(date.getUTCMonth()+1) + '-' + date.getUTCFullYear();
optionElement = $('<option>')
optionElement.attr('value',formattedDate);
optionElement.text(formattedDate);
selectElement.append(optionElement);
}

You can use the "count" according to your logic.