Mar 3rd, 2012, 1:45 AM
Hi Glen,
Great problem. If I were to tackle this, I’d add two new settings to your new Date field type: “Min Date” and “Max Date”, where you could define the allowed dates. That way, you could re-use your new Date field type as many times as you need, with different permitted date ranges in each instance.
[N.B. Unfortunately, in terms of inputting that info, you can only provide a simple text box. So it would be up to you to enter a date in a specific format, to be pulled apart and used by the field type on page load, e.g. YYYY-MM-DD]
In terms of the JS you need, what you included in your post actually looks okay. Double check your selector, perhaps... do you maybe need to wrap it in a $(function() { … }); so it runs onload? Possibly not, but worth checking.
- Ben
Great problem. If I were to tackle this, I’d add two new settings to your new Date field type: “Min Date” and “Max Date”, where you could define the allowed dates. That way, you could re-use your new Date field type as many times as you need, with different permitted date ranges in each instance.
[N.B. Unfortunately, in terms of inputting that info, you can only provide a simple text box. So it would be up to you to enter a date in a specific format, to be pulled apart and used by the field type on page load, e.g. YYYY-MM-DD]
In terms of the JS you need, what you included in your post actually looks okay. Double check your selector, perhaps... do you maybe need to wrap it in a $(function() { … }); so it runs onload? Possibly not, but worth checking.
- Ben