The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
minDate() not working in frm_date_field_js
Please help.
I am implementing a simple date picker restricting selections from 01/01/1900 to 08/25/2000. My code in a snippet is...
add_action('frm_date_field_js', 'limit_my_date_field');
function limit_my_date_field($field_id){
if($field_id == 'FIELDKEY '){ //change FIELDKEY to the key of your date field
echo ', minDate(1900, 0, 1), maxDate(2018, 7, 25)';
} else {
echo ',minDate: null, maxDate: null';
}
}
Earliest year/mo/day works. Check.
Latest year works. Check.
Latest month and day do not get validated. Ie. User is able to select dates past 08/25/2000.
Can anyone tell me what I'm doing wrong?
Thanks!
April 10, 2018 at 6:19 am
Your maxdate() in the code example is 2018, not 2000.
April 10, 2018 at 2:42 pm
Man thanks for your response!
Sorry for the typo. However, even with the maxDate() using 2000 (see code below), it accepts invalid values.
I've also attached a screenshot of the FF settings. I'm thinking it may be related to the fact that I have values in the Year Range field. But when I don't add values there, FF will default to 0,+10 anyways. So it is still "broken".
Any ideas?
Attachment:
Discussion closed.